fix(organizations): disable personal account for new SSO signups - #4921
Merged
Conversation
The invite flow (#4447) disables personal_account_disabled for accounts created specifically to join an org, but the SSO JIT provisioning path never did, so brand-new SSO signups kept the schema default of false. Mirror the invite behavior in addSsoUserToOrganization: when a brand-new account is provisioned via SSO and the membership is inserted, disable the personal account within the same transaction. Existing users who authenticate through SSO keep their current value.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryReviewed the SSO JIT-provisioning change that disables Files Reviewed (4 files)
Verification Notes
Reviewed by claude-opus-5 · Input: 58 · Output: 7.5K · Cached: 1.3M Review guidance: REVIEW.md from base branch |
RSO
enabled auto-merge (squash)
July 31, 2026 12:27
jeanduplessis
approved these changes
Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Signing up through SSO created an account with
personal_account_disabled=falsewhen it should betrue.The feature that disables the personal account for accounts created specifically to join an org was only ever implemented for the invitation flow (#4447,
acceptOrganizationInvite). The SSO JIT provisioning path (processSSOUserLogin→createOrUpdateUser→addSsoUserToOrganization) never touched the flag, so brand-new SSO accounts kept the schema default offalse.Fix
Mirror the invite-flow behavior for SSO, atomically within the membership-insert transaction:
addSsoUserToOrganizationnow accepts an optional{ isNewUser }. When the membership is actually inserted and the account is brand-new, it setspersonal_account_disabled: truein the same transaction.sso.tspassesisNewUser: res.isNew(fromcreateOrUpdateUser).The disabling is gated on
added && isNewUser. A brand-new user can't have a removal tombstone (soaddedis always true here), but gating onaddedkeeps the flag from being flipped for a non-member if the tombstone guard ever short-circuits, matching how the invite flow only disables within a successful-insert path.Tests
organizations.test.ts: new SSO user →personal_account_disabled=true; existing SSO user → staysfalse.sso.test.tscall-args assertion for the new{ isNewUser: true }argument.Note
This only affects accounts created going forward. Accounts already provisioned via SSO with
falseneed a manual correction (e.g. the admin toggle) if desired.