Skip to content

[PM-32424] Send Access Enumeration protection#821

Merged
ike-kottlowski merged 7 commits intomainfrom
auth/pm-32424/send-enumeration-protection
Mar 10, 2026
Merged

[PM-32424] Send Access Enumeration protection#821
ike-kottlowski merged 7 commits intomainfrom
auth/pm-32424/send-enumeration-protection

Conversation

@ike-kottlowski
Copy link
Copy Markdown
Contributor

@ike-kottlowski ike-kottlowski commented Mar 6, 2026

🎟️ Tracking

PM-32424

Client PR: bitwarden/clients#19422
Server PR: bitwarden/server#7166

📔 Objective

Improve enumeration protection of Sends

🚨 Breaking Changes

@ike-kottlowski ike-kottlowski changed the title feat: handle error message responses for invalid_otp [PM-32424] Send Access Enumeration protection Mar 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 6, 2026

Logo
Checkmarx One – Scan Summary & Detailsff298a38-0fa4-4582-a5c6-3d93644bb0aa

Great job! No new security vulnerabilities introduced in this pull request

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 6, 2026

🔍 SDK Breaking Change Detection Results

SDK Version: auth/pm-32424/send-enumeration-protection (d9001d4)
Completed: 2026-03-10 15:14:58 UTC
Total Time: 247s

Client Status Details
typescript ❌ Breaking changes detected TypeScript compilation failed with new SDK version - View Details

Breaking change detection completed. View SDK workflow

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.31%. Comparing base (fa86d4d) to head (d9001d4).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #821      +/-   ##
==========================================
+ Coverage   82.30%   82.31%   +0.01%     
==========================================
  Files         346      346              
  Lines       41401    41434      +33     
==========================================
+ Hits        34075    34108      +33     
  Misses       7326     7326              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

async fn request_send_access_token_invalid_grant_invalid_otp_error() {
// Create a mock error response
let error_description = "otp is invalid.".into();
async fn request_send_access_token_invalid_request_invalid_otp_error() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ : request_send_access_token_invalid_request_invalid_email_error and request_send_access_token_invalid_request_invalid_otp_error are in the invalid_grant_tests module but both assert InvalidRequest responses.
They should be moved to request_send_access_token_invalid_request_tests even though they used to be invalid grant errors.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@claude
Copy link
Copy Markdown

claude bot commented Mar 9, 2026

Claude finished @ike-kottlowski's task in 2m 30s —— View job


Re-Review: Approve

PR: PM-32424 Send Access Enumeration protection

Summary

Changes since last review are test-only improvements that address prior feedback: test function names were updated to better describe enumeration protection semantics (e.g., _masked_as_otp_required suffix), a new test was added for the unrecognized-email-with-EmailOtp-credential scenario, and a minor comment was corrected. No production code changed since the previous review.

Full PR Assessment

Changed files:

  • crates/bitwarden-auth/src/send_access/api/token_api_error_response.rs -- Removes OtpInvalid and OtpGenerationFailed variants from SendAccessTokenInvalidGrantError, updates corresponding tests.
  • crates/bitwarden-auth/src/send_access/client.rs -- Reorganizes integration tests into correct modules (invalid_request_tests vs invalid_grant_tests), adds three new tests documenting server-side enumeration protection behavior.

Security: The changes correctly implement enumeration protection by removing specific OTP error variants from the SDK. The server now returns a generic email_and_otp_required (InvalidRequest) response for invalid OTP, unrecognized email, and missing credentials scenarios, preventing email enumeration. The #[serde(other)] Unknown fallback ensures forward compatibility with future server error types.

Breaking changes: Removing OtpInvalid and OtpGenerationFailed from SendAccessTokenInvalidGrantError is a breaking change, confirmed by the automated TypeScript compatibility check. This is intentional and coordinated with the paired client PR.

No issues found.

@ike-kottlowski ike-kottlowski marked this pull request as draft March 9, 2026 20:27
@ike-kottlowski ike-kottlowski marked this pull request as ready for review March 9, 2026 22:20
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

@JaredSnider-Bitwarden JaredSnider-Bitwarden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ike-kottlowski ike-kottlowski merged commit 1b1af08 into main Mar 10, 2026
61 checks passed
@ike-kottlowski ike-kottlowski deleted the auth/pm-32424/send-enumeration-protection branch March 10, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Request a Claude code review breaking-change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants