security: migrate AES-CBC to AES-GCM authenticated encryption#2331
Open
3em0 wants to merge 1 commit intoarc53:mainfrom
Open
security: migrate AES-CBC to AES-GCM authenticated encryption#23313em0 wants to merge 1 commit intoarc53:mainfrom
3em0 wants to merge 1 commit intoarc53:mainfrom
Conversation
…d encryption AES-CBC without message authentication (HMAC) is vulnerable to ciphertext tampering and theoretical padding oracle attacks. AES-GCM provides both confidentiality and integrity in a single primitive. - encrypt_credentials now uses AES-256-GCM with a version byte prefix - decrypt_credentials auto-detects format: v1 (GCM) vs legacy (CBC) - Legacy CBC decryption preserved for backward compatibility - Added tests for GCM round-trip, legacy CBC compat, and tamper detection Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
| Someone is attempting to deploy a commit to the Arc53 Team on Vercel. A member of the Team first needs to authorize it. |
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
application/security/encryption.py, providing both confidentiality and integrity for stored credentials{})Motivation
AES-CBC without HMAC lacks ciphertext integrity protection. While the practical Padding Oracle attack surface is limited (no direct decrypt endpoint), the absence of authenticated encryption is a cryptographic deficiency. AES-GCM resolves this in a single primitive.
Changes
application/security/encryption.pyencrypt_credentials→ AES-256-GCM;decrypt_credentials→ version-byte dispatch (GCM vs legacy CBC)tests/security/test_encryption.pytest_decrypt_legacy_cbc_formatandtest_tampered_gcm_ciphertext_returns_emptyTest plan
pytest tests/security/test_encryption.py -v— 8/8 passed{})🤖 Generated with Claude Code