Repository navigation
feat(auth): identity provider owns accounts when roles are mapped - #459
Merged
Merged
Conversation
With an OIDC group-to-role mapping, an administrator could still create local users and change roles. A later login with the same verified email then linked to that local account, and the mapping overwrote the role, so the browser routes were a second, conflicting source of accounts. The browser user routes now refuse those changes with 403 and the code managed_by_identity_provider. Adding a SCIM token extends the refusal to status, email, and deletion, because the directory owns those too. SCIM and login-time reconciliation go through the store and are not affected. Without a mapping nothing changes, including with a SCIM token alone. /api/auth/status publishes the mode as account_ownership so the browser does not work it out from settings, and Settings explains it. Fanout has no screen that changes other users, so there are no controls to hide. Reactivation now revokes OAuth tokens and authorization codes as well. Revocation ran only on leaving active, so accounts suspended before it existed, and tokens minted in a race with suspension, became valid again. The empty-database messages no longer mention setup when a SCIM token is set, because browser setup is disabled in that configuration.
With a role mapping, no SCIM token, and auto-provisioning at its default of
off, POST /api/users is refused and a first login is denied as not
provisioned, so nobody new can get an account. Existing installations with
this combination must still start after upgrading, so this is a startup
warning and not a validation error.
/api/auth/status reports the case as its own mode. Settings no longer claims
the identity provider creates accounts when it does not, and the docs say
that adding users under a mapping needs auto-provisioning with an allow-list,
or SCIM.
The docs also state that PATCH /api/users/{id} returns 400 for malformed JSON
before the ownership check, since it must decode the body to see email.
The mapping check moves to config so the startup warning and the routes use
one definition.
Only the generated browser assets conflicted, so they are rebuilt from the merged sources.
vishr
enabled auto-merge
November 8, 2026 23:45
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 8, 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.
Closes #445.
With an OIDC group-to-role mapping, an administrator could still create local users and change roles. A later login with the same verified email then linked to that local account and the mapping overwrote its role. The browser user routes now leave those changes to the identity provider.
Behaviour
account_ownershiplocalidentity_provider_rolesidentity_provider_roles_no_provisioningidentity_provider_directoryA refusal is
403with the codemanaged_by_identity_provider. It changes nothing and names no group or token. Role mapping is one check inconfig, shared by the routes, login reconciliation and the startup warning, so a list of only commas and spaces counts as no mapping. It applies only in OIDC mode.Upgrade note
This is a runtime and security behaviour change for installations with
FANOUT_OIDC_ADMIN_GROUPSorFANOUT_OIDC_OPERATOR_GROUPSset: administrators lose those browser routes on upgrade.With a role mapping, no SCIM token and
FANOUT_OIDC_AUTO_PROVISIONat its default of off, nobody new can get an account:POST /api/usersis refused and a first login is denied as not provisioned. To add users, setFANOUT_OIDC_AUTO_PROVISIONwithFANOUT_OIDC_ALLOWED_GROUPSorFANOUT_OIDC_ALLOWED_DOMAINS, or configure a SCIM token. Fanout still starts in this configuration, because existing installs must keep starting after upgrade. It logs a warning at startup and Settings says so. Existing accounts keep working./api/auth/statusgainsaccount_ownership.Paths left alone
PATCH /api/users/{id}with onlydisplay_name. The issue does not list it. A directory sendingdisplayNameoverwrites it on its next update.POST /api/users/{id}/access/revoke. It ends sessions and OAuth tokens and does not change the account, and an administrator needs it during an incident.POST /api/auth/setup. It creates the first administrator when there is no SCIM token, and without it a role-mapped install has no first login path. With a SCIM token it already returns410.fanout login-link --break-glass. It writes no account fields, and issue and redemption are tested with role mapping and a SCIM token. There are no import, invite or restore routes beyondPOST /api/users, which is refused.UI
Fanout has no screen that creates, edits, suspends or deletes other users, so there are no controls to hide or disable. Settings gains a "User accounts" notice, shown only when the server reports an identity-provider mode, that says what is refused and why. When nothing can create accounts it is a warning that says so. It uses the shared
Noticeand is covered by Settings stories in the light and dark design check.Follow-ups from the SCIM review
applyUpdatenow revokes OAuth tokens and authorization codes on the transition into active as well. Accounts suspended before suspension revoked credentials, and tokens minted in a race with suspension, no longer become valid on reactivation. The test leaves a token and a code unrevoked on a suspended account and reactivates through both the browser route and SCIM; it fails against the old condition.Known limit
With role mapping and no SCIM token, an administrator can still change the email of an unlinked local account, and unlinked local accounts stay claimable by email at a later login. This PR does not close that path.
For reviewers
account_ownershipis on the public/api/auth/statusroute, so an unauthenticated visitor can tell whether role mapping, auto-provisioning and SCIM are on. It carries no values, and that route already reportsauth_modeandself_signup.PATCH /api/users/{id}has to decode the body to see whetheremailis present, so malformed JSON there returns400.Testing
just checkpasses, andjust test-racepasses forinternal/api,internal/auth,internal/configandcmd/fanout. The full race suite was not run locally. The Settings stories pass the design check in light and dark at both review widths. The branch mergesmainto resolve conflicts in the generated browser assets.