[PM-41693] Align error behavior when Send is not accessible - #8229
[PM-41693] Align error behavior when Send is not accessible #8229harr1424 wants to merge 2 commits into
Conversation
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE This PR collapses the The latest commit adds two end-to-end tests ( Code Review DetailsNo new findings. The previously raised question about the removal of the Send enumeration protection was answered by the author with the internally tracked ticket PM-41693, so it is not reopened here. |
| SendAuthenticationMethod method = send switch | ||
| { | ||
| null => NEVER_AUTHENTICATE, | ||
| null => SEND_INACCESSIBLE, |
There was a problem hiding this comment.
❓ QUESTION: Was the removal of the Send enumeration protection reviewed with the security team?
Context
This change (plus the deletion of SendNeverAuthenticateRequestValidator and GlobalSettings.SendDefaultHashKey) removes a control that was deliberately added to prevent distinguishing a non-existent send_id from one that exists and requires auth. After this PR, an unknown send_id deterministically returns invalid_grant / send_id_invalid, while an existing, accessible, password- or OTP-protected Send returns password_hash_b64_required / email_required — so the two states become reliably distinguishable.
The PR description acknowledges the trade-off, and the residual risk looks low given Send IDs are 122 bits of randomness (offline enumeration is infeasible; the practical leak is limited to someone who already holds a link learning whether the Send is still live). Asking mainly so the sign-off is recorded on the PR — was AppSec looped in, given this reverses an explicitly documented anti-enumeration measure?
There was a problem hiding this comment.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8229 +/- ##
==========================================
- Coverage 63.30% 63.27% -0.03%
==========================================
Files 2383 2400 +17
Lines 103898 103986 +88
Branches 9402 9421 +19
==========================================
+ Hits 65771 65802 +31
- Misses 35883 35929 +46
- Partials 2244 2255 +11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| var requestBody = new FormUrlEncodedContent([ | ||
| new KeyValuePair<string, string>(OidcConstants.TokenRequest.GrantType, CustomGrantTypes.SendAccess), | ||
| new KeyValuePair<string, string>(OidcConstants.TokenRequest.ClientId, BitwardenClient.Send) | ||
| ]); |
ike-kottlowski
left a comment
There was a problem hiding this comment.
Just the comment about notifying SRE of the globalsettings shape change.
| /// <summary> | ||
| /// This Hash Key is used to prevent enumeration attacks against the Send Access feature. | ||
| /// </summary> | ||
| public virtual string SendDefaultHashKey { get; set; } |
There was a problem hiding this comment.
We want to make sure we're keeping our settings files lean so we will want to remove this setting.
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-41693
📔 Objective
This PR improves user experience by standardizing the server's response when a Send should not be accessed (a non-exhaustive list is in the section below). These changes come at the expense of guarding against enumeration in the event that a Send had been deliberately deleted; formerly this situation would result in one of three random error messages.
The following behavior was flagged as a defect:
One of the random error responses indicated the Send required password authentication, this was surfaced to the user as
password_hash_b64_requiredA different random error response would result in an infinite OTP auth flow
Internal product teams requested changes to align error behavior whenever a Send should not be accessible (see list below).
📸 Screenshots
The above message will be shown in ALL of the following situations: