Repository navigation
security(scim): scope user deprovisioning to the calling org - #854
Merged
Merged
Conversation
A SCIM token is issued per organization, but deprovisioning wrote the global user row and deleted every session, so one org could disable a shared account for all the others. Membership existence also granted org-admin authority.
Withholding the global revocation marker left the paths that relied on it ungated, so a deprovisioned member kept this org's FGA grants and could log back in through its own SSO endpoint.
Merged
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.
is_active=falseand the revocation marker) and deleted every session keyed by user id. Org A could disable a shared account, and end its live sessions, for org B — including one of B's own org admins. Two breaking changes:PATCH {"active": true}restores the membership only and does not lift a global revocation while the user stays active in another organization; deprovision deletes the user's FGA grants inside that organization and reprovision does not restore them, so the IdP must re-sync group membership and an admin must re-grant each manual grant.internal/storage/schemas/org_membership.go: addDeprovisionedAt *int64and theActive()helper. It is a nullable timestamp and not anIsActive boolon purpose — no backend backfills a new column, so a SQL NULL, an unset Cassandra column and an absent document key all decode tofalse, and a bool locks every existing member out on upgrade. Absent must mean active.internal/service/scim/scim.go:SetActive,ReplaceUserandPatchUserdeprovision the MEMBERSHIP, and take the global account down only when no other organization still has the user active. Read paths reportactiveper organization. The count of other active memberships runs AFTER the membership write, because the read-then-write order lets two organizations deprovision at the same time and leave a live account with no active membership.internal/service/scim/groups.go,internal/http_handlers/oauth_sso.go: deprovision DELETES every FGA tuple that names the user inside that organization, and SSO/JIT login gates on the membership. Without both,check_permissionskeeps answering allowed and the member logs back in through the organization's own SSO endpoint. An access token already issued for the organization still works until it expires, becauseschemas.SessionandSessionTokencarry no org id. Risk to check: the purge scopes by the object's<type>:<orgID>/prefix, so a model that namespaces objects differently is missed.internal/service/admin_provider.go,internal/service/admin_organizations.go,internal/http_handlers/saml_idp.go: deny a deprovisioned membership, and count only ACTIVE admins in the last-admin guard. Org-admin authority, SAML assertion issuance and the guard disagreed about what a member is, which let the last active admin remove themselves.