Skip to content

Auth/PM-41517 - Registration with an Open Org Invite Link - Allow when DisableUserRegistration Enabled - #8277

Open
JaredSnider-Bitwarden wants to merge 4 commits into
mainfrom
auth/pm-42625/registration-w-open-org-invite-should-ignore-disable-open-registration
Open

Auth/PM-41517 - Registration with an Open Org Invite Link - Allow when DisableUserRegistration Enabled#8277
JaredSnider-Bitwarden wants to merge 4 commits into
mainfrom
auth/pm-42625/registration-w-open-org-invite-should-ignore-disable-open-registration

Conversation

@JaredSnider-Bitwarden

@JaredSnider-Bitwarden JaredSnider-Bitwarden commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-41517
previously https://bitwarden.atlassian.net/browse/PM-42625

📔 Objective

  • The DisableUserRegistration self-hosted toggle targets open self-registration, but a validated open-org invite link is itself the authorization for the invited path — so gating that path behind the toggle was incorrect.
  • Two call sites were doing this:
    1. SendVerificationEmailForRegistrationCommand.Run — the guard is moved below the invite validator and skipped when a valid invite is present.
    2. RegisterUserCommand.RegisterUserViaEmailVerificationTokenAndOpenOrgInvite — the redundant guard is dropped entirely.
  • Unit and integration coverage added to pin the new behavior end to end.

📸 Screenshots

n/a - integration tests are sufficient.

…ation is on

The DisableUserRegistration self-hosted admin toggle targets open self-registration;
possession of a valid open-org invite link is itself the authorization for the
RegisterUserViaEmailVerificationTokenAndOpenOrgInvite path, so the guard was
incorrectly ported over and broke fedramp deployments. Adds integration and unit
tests pinning the new behavior.
@JaredSnider-Bitwarden JaredSnider-Bitwarden added t:bugfix Change Type - Bugfix ai-review Request a Claude code review labels Aug 27, 2026
@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

Re-reviewed the DisableUserRegistration bypass for the open-org-invite registration path at head bcdf40a. The only change since the prior review at 3f910e3 is a merge from main that touches unrelated util/Seeder files; the auth diff is unchanged and both earlier findings remain addressed. Traced the trust boundary at both crossings: SendVerificationEmailForRegistrationCommand.Run throws on an invalid invite before reaching the relocated toggle check, and RegisterUserCommand.RegisterUserViaEmailVerificationTokenAndOpenOrgInvite re-validates the invite via IValidateOrganizationInviteLinkQuery (code match, org enabled, UseInviteLinks, domain allowlist) before creating the user, so the guard removal does not open an unauthenticated path — and both endpoints stay behind FeatureFlagKeys.GenerateInviteLink. Treating a validated invite as the authorization matches the existing precedent in RegisterUserViaOrganizationInviteToken, and unit plus integration coverage pins the new behavior end to end.

Code Review Details

No findings.

@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.44%. Comparing base (54ce9ce) to head (3f910e3).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8277      +/-   ##
==========================================
+ Coverage   63.32%   63.44%   +0.11%     
==========================================
  Files        2430     2430              
  Lines      104922   104928       +6     
  Branches     9505     9505              
==========================================
+ Hits        66447    66569     +122     
+ Misses      36198    36080     -118     
- Partials     2277     2279       +2     

☔ View full report in Codecov by Harness.
📢 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.
The DisableUserRegistration guard in SendVerificationEmailForRegistrationCommand
fired before the open-org invite was even inspected, so no user could reach
register-finish on a self-hosted instance with the toggle on. Moves the guard
below the invite validator and skips it for validated invites, letting the
integration test exercise the real send endpoint end to end.
Mirrors the pattern on RegisterUserViaSalesAssistedToken so a future reader
normalizing guards across these methods sees the reasoning at the contract
rather than inferring it from what's missing in the implementation.
@JaredSnider-Bitwarden
JaredSnider-Bitwarden marked this pull request as ready for review August 27, 2026 18:31
@JaredSnider-Bitwarden
JaredSnider-Bitwarden requested a review from a team as a code owner August 27, 2026 18:31
@JaredSnider-Bitwarden
JaredSnider-Bitwarden removed the request for review from enmande August 27, 2026 18:42
@JaredSnider-Bitwarden JaredSnider-Bitwarden changed the title Auth/PM-42625 - Registration with an Open Org Invite Link - Allow when DisableUserRegistration Enabled Aug 31, 2026
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 needs-qa t:bugfix Change Type - Bugfix

3 participants