Skip to content

Conversation

@ike-kottlowski
Copy link
Contributor

@ike-kottlowski ike-kottlowski commented Jan 28, 2026

🎟️ Tracking

PM-30563

SDK PR: #717
Client PR: #18620

📔 Objective

To ensure that we return the same response for a valid and invalid email, while still sending the OTP to when the email is correct.

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 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

…required to protect against enumeration attacks.
test: updating tests to match new approach.
@github-actions
Copy link
Contributor

github-actions bot commented Jan 28, 2026

Logo
Checkmarx One – Scan Summary & Detailsdfcbc514-c0c2-4d0a-8db7-ddfebba6290f

New Issues (2)

Checkmarx found the following issues in this Pull Request

# Severity Issue Source File / Package Checkmarx Insight
1 MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 291
detailsMethod at line 291 of /src/Api/Auth/Controllers/AccountsController.cs gets a parameter from a user request from model. This parameter value flow...
Attack Vector
2 MEDIUM CSRF /src/Api/Auth/Controllers/AccountsController.cs: 452
detailsMethod at line 452 of /src/Api/Auth/Controllers/AccountsController.cs gets a parameter from a user request from model. This parameter value flow...
Attack Vector
Fixed Issues (29)

Great job! The following issues were fixed in this Pull Request

Severity Issue Source File / Package
MEDIUM CSRF /src/Api/Tools/Controllers/SendsController.cs: 68
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 1428
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 1428
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 1428
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 1403
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 1527
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 1457
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 1311
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 847
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 847
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 1457
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 775
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 807
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 807
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 775
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 1403
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 293
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 1088
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 1508
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 245
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 161
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 191
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 216
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 1457
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 1017
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 732
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 1050
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 1160
MEDIUM CSRF /src/Api/Vault/Controllers/CiphersController.cs: 293

@ike-kottlowski ike-kottlowski changed the title [PM-30563] Change error response to protect against enumeration [PM-30563] Change error response on Send Access token request Jan 28, 2026
@ike-kottlowski ike-kottlowski added the ai-review Request a Claude code review label Jan 28, 2026
@claude
Copy link
Contributor

claude bot commented Jan 28, 2026

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


Code Review: PM-30563 - Change error response on Send Access token request

Status: Approved

Summary

This PR improves enumeration protection for the Send access email OTP flow by ensuring identical error responses regardless of whether an email address is valid. This is a well-implemented security improvement.

Re-Review Notes

This is a re-review following a merge from main (commit 1a889ac) which incorporated PR #6921's changes to use email hashes instead of plain emails. The merge was clean and the enumeration protection logic remains correctly implemented.

Changes Reviewed

File Changes
SendAccessConstants.cs Removed EmailInvalid, renamed EmailOtpSent to EmailAndOtpRequired
SendEmailOtpRequestValidator.cs Invalid emails now return same response as valid emails needing OTP
SendNeverAuthenticateRequestValidator.cs Updated to use new constant names and consistent error types
Test files (5 files) Properly updated to reflect new behavior

Security Verification

The enumeration protection is correctly implemented:

Scenario Response Server-side Action
Invalid email email_and_otp_required No OTP generated (returns early at line 54-57)
Valid email, no OTP email_and_otp_required OTP generated and sent
Result Identical HTTP responses Prevents email enumeration

An attacker cannot distinguish whether an email exists in the Send's allowed list based on the response alone.

Code Quality

  • Clear documentation comment at lines 47-53 in SendEmailOtpRequestValidator.cs explaining the design decision
  • Snapshot tests ensure SDK compatibility
  • All removed constants (EmailInvalid, EmailOtpSent) have no remaining references
  • Error type for EmailAndOtpRequired correctly changed from InvalidGrant to InvalidRequest for consistency

No Issues Found

This is a clean, focused security improvement that follows best practices for enumeration protection.


Reviewed by Claude Code

@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.07%. Comparing base (51aa419) to head (1a889ac).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6911      +/-   ##
==========================================
- Coverage   60.01%   56.07%   -3.95%     
==========================================
  Files        1971     1971              
  Lines       87090    87089       -1     
  Branches     7759     7759              
==========================================
- Hits        52266    48833    -3433     
- Misses      32928    36449    +3521     
+ Partials     1896     1807      -89     

☔ 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.

@ike-kottlowski ike-kottlowski marked this pull request as ready for review January 28, 2026 16:26
@ike-kottlowski ike-kottlowski requested a review from a team as a code owner January 28, 2026 16:26
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants