-
Notifications
You must be signed in to change notification settings - Fork 166
fix: Fixes the IV overwrite when trying to encrypt multiple credentials #882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This comment has been minimized.
This comment has been minimized.
|
Claude finished @pmathew92's task —— View job Code Review CompleteOverall Assessment❌ This PR addresses a critical IV collision bug in the credential encryption system, but has several security and code quality issues that should be addressed before merging. Strengths
Critical Issues Requiring AttentionSecurity Concerns:
Code Quality:
Performance: RecommendationsThe cryptographic approach is sound, but the implementation needs hardening against edge cases and malformed input. Please review the inline comments for specific suggestions to improve input validation, error handling, and code clarity. |
Changes
This PR fixes the issue caused when the Initialisation Vector (IV) used to encrypt the
Credentialsin theSecureCredentialsManagergets overwritten with another IV when used along themultiple resource refresh tokenflow.Cause
The IV generated while encrypting one set of credentials are stored in the shared preference using a key. When used along with the
mrrtflow, the same shared preference key is used to store the new IV which replaces the existing one used to encrypt the first set of credentials. This results in aCryptoExceptionwhen the new IV is used to decrypt the original set of credentials.Fix
Instead of storing the IV in the shared preference , The IV is encrypted alongside the Credentials and stored. This ensures all set of different credentials would have their own IV which can later be extracted to decrypt them hence avoiding any exception. The Fix also ensures seamless migration for existing set of stored Credentials using the old manner.
Testing
Manual tests has been conducted for migration scenario and along with multiple set of credentials
This change adds unit test coverage
This change adds integration test coverage
This change has been tested on the latest version of the platform/language or why not
Checklist
I have read the Auth0 general contribution guidelines
I have read the Auth0 Code of Conduct
All existing and new tests complete without errors