-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat(auth-validator): [Auth/PM-22975] Client Version Validator #6588
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
base: main
Are you sure you want to change the base?
feat(auth-validator): [Auth/PM-22975] Client Version Validator #6588
Conversation
|
New Issues (6)Checkmarx found the following issues in this Pull Request
|
…hups to baserequest validator.
…e white spaces as well as the renaming of a file
…ixing the rename to the correct file.
src/Identity/IdentityServer/RequestValidators/BaseRequestValidator.cs
Outdated
Show resolved
Hide resolved
…ng a little to be more clear.
|
Claude finished @Patrick-Pimentel-Bitwarden's task in 3m 25s —— View job Code Review CompleteThe specialized review agent has completed its analysis and posted detailed findings as inline comments and a summary review. Review completed successfully. |
src/Identity/IdentityServer/RequestValidators/BaseRequestValidator.cs
Outdated
Show resolved
Hide resolved
src/Identity/IdentityServer/RequestValidators/BaseRequestValidator.cs
Outdated
Show resolved
Hide resolved
src/Identity/IdentityServer/RequestValidators/ClientVersionValidator.cs
Outdated
Show resolved
Hide resolved
src/Core/KeyManagement/Queries/GetMinimumClientVersionForUserQuery.cs
Outdated
Show resolved
Hide resolved
|
I am seeing 100 failures in tests, double checking what is going on, consider holding off on approving. |
Finding 3: Important - Error message reveals encryption stateLocation: Issue: The error message "Please update your app to continue using Bitwarden" reveals the user has v2 encryption enabled. This creates an information disclosure vulnerability:
Combined with the timing side-channel, this confirms account encryption status. Recommendation: Use a generic error message that doesn't reveal encryption state: private const string _upgradeMessage = "Authentication failed. Please ensure you are using the latest version of Bitwarden.";This maintains the user experience (prompting upgrade) while not explicitly revealing the account has v2 encryption. |
Finding 4: Question - SecurityVersion validation strictnessLocation: Question: The comment states:
The current implementation only checks for private bool IsSecurityVersionTwo()
{
return SecurityVersion == 2;
}Questions:
The method name |
Finding 5: Technical Debt - Method name doesn't match async patternLocation: Issue: The method bool ValidateAsync(User user, CustomValidatorRequestContext requestContext);The implementation (line 31) doesn't use Options:
Impact: Low-priority but creates confusion and violates established patterns in the codebase. |
Finding 6: Suggested - Add null-safety to ClientVersionValidatorLocation: Suggestion: Add
Trade-off: Requires updating |
Finding 7: Suggested - Optimize encryption type detectionLocation: Suggestion: Reverse the order of checks in public bool HasV2Encryption()
{
// Fast check first (integer comparison)
if (!IsSecurityVersionTwo())
{
return false;
}
// Only parse if security version matches
return HasV2KeyShape();
}This leverages short-circuit evaluation to eliminate the string parsing operation when Measured benefit: Eliminates string parsing for 100% of v1 users. Neutral for v2 users. |
Positive Observations
SummaryThe PR implements the core functionality correctly, but has a critical backward compatibility issue (Finding 1) that will break authentication for v1 users when clients don't send the header. The security concerns (Findings 2-3) should also be addressed before merge to prevent information leakage about account encryption state. 🤖 Generated with Claude Code Co-Authored-By: Claude [email protected] |
Re-Review Update - PR #6588Thank you for the feedback on my previous review. I've reconsidered Finding 1 in light of the design intent expressed in the code comments (lines 44-47 of ClientVersionValidator.cs). Re: Finding 1 (Backward Compatibility) I understand the intention is to establish a strict contract requiring ALL clients to send the However, I want to ensure you've considered:
If these scenarios are covered (e.g., header has been sent by clients for 6+ months, or there's a coordinated release plan), then the strict validation is appropriate. The "NEEDS TESTING ON FEATURE BRANCH" note in the PR suggests you're already aware of the need for careful validation. Remaining Security Concerns The other findings from my initial review remain valid:
These information disclosure issues should be addressed regardless of the backward compatibility decision. 🤖 Generated with Claude Code Co-Authored-By: Claude [email protected] |
Updated Security Review - PR #6588After reconsidering Finding 1 based on design intent (requiring header from all clients appears intentional), the following security concerns remain: Finding 2: Timing Side-Channel (IMPORTANT)Location: Issue: The validator performs user-specific checks without delay, creating timing differences between v1 and v2 users that could reveal encryption status to attackers with valid credentials. Recommendation: Add 100-200ms delay before returning false to normalize response times. Finding 3: Information Disclosure (IMPORTANT)Location: Issue: Error message "Please update your app to continue using Bitwarden" explicitly reveals the account has v2 encryption enabled. Recommendation: Use generic error message that doesn't disclose encryption state. Finding 4: Future-Proofing Question (QUESTION)Location: Question: Method checks 🤖 Generated with Claude Code Co-Authored-By: Claude [email protected] |
3bd54e5
6e144c8 to
f44cd58
Compare


NEEDS TESTING ON FEATURE BRANCH
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-22975
📔 Objective
The objective of this ticket is to create a client version validator that checks the header data on a token request and prevent users who have migrated to v2 from logging in with older client versions.
📸 Screenshots
Validator.Working.mov
Non.Rotated.Key.Working.Fine.mov
⏰ Reminders before review
🦮 Reviewer guidelines
:+1:) or similar for great changes:memo:) or ℹ️ (:information_source:) for notes or general info:question:) for questions:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion:art:) for suggestions / improvements:x:) or:warning:) for more significant problems or concerns needing attention:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt:pick:) for minor or nitpick changes