Repository navigation
feat(auth): add OIDC account linking and role policies - #344
Merged
Merged
Conversation
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 15 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. CodeRabbit Verify
|
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.
Summary
OIDC currently accepts owner-preconfigured identity bindings, while completed sessions lose their external authority. This adds verified self-service linking/unlinking and opt-in provisioning with explicit group-to-role mappings. Existing email addresses are never claimed automatically, local account roles remain local, and externally managed accounts cannot become owners or acquire local credentials through password reset or invitations.
Sessions retain provider and binding provenance through local MFA, recheck current trust and access, and expire within the verified ID token lifetime and a 15-minute cap. Removed groups revoke managed grants and sessions even when authentication is denied. Per-binding generations prevent unlink/relink resurrection without signing out other users of the provider. Backup restore and its maintenance fence retain only eligible local sessions.
This completes the backend/API scope of #296. The policy editor and self-service connection UI remain in #297; the existing provider editor preserves the new policy fields during unrelated edits.
Related issue
Closes #296.
Type of change
Testing
Generated migration using
bun --no-env-file run db:generateand applied it to a fresh disposable PostgreSQL 18 database.75 PostgreSQL/Valkey integration tests pass, covering provisioning, collisions, concurrent linking, role removal, local MFA, existing session invalidation, restore session continuity, and existing authentication/recovery behavior.
Dedicated session-maintenance fixture passes its 10 targeted PostgreSQL checks.
Full unit suite outside the Windows sandbox: 4,078 pass, 76 skip, 10 baseline Windows/MSYS failures. Seven unchanged Beta 2 scheduler tests require POSIX
0600stat reporting; three unchanged own-image dependency tests hit Git Bash's unsupportedulimit -f. No OIDC/auth suite fails.Final affected restore, claim projection and provider-editor checks: 44 pass.
Production web build, web/script typechecks, regular/type-aware Oxlint, formatting and diff checks pass.
Focused independent review covered linking races, provider/binding generations, owner/recovery protections, MFA provenance and restore continuity. No long-running release tests were started.
CI follow-up: 78 focused managed-backup, persistence/compatibility, Beta 2 diagnostics and runtime-scale tests pass. Historical local accounts normalize only the newly added NULL provider column; non-NULL ownership and other data remain strictly compared. Backup fixtures explicitly identify new local sessions. Beta 2 retains its original three-round, 100-host workload and transport behavior, with strict failure propagation and sanitized phase diagnostics.
Linux GitHub Actions at 8f12072: 4,143 unit/tooling tests, 282 database integration tests and 4 host-page storage integration tests pass, with 39 conditional skips and no failures. Beta 2, fresh/oldest/previous compatibility and the short runtime profile also pass. Managed-backup smokes pass real web authentication, secure download and recovery checks.
Checklist
Breaking changes
Migration 0032 requires existing browser sessions to sign in again once, because their original authentication source is unknown. Existing local passwords, passkeys and owner recovery remain intact. OIDC sessions require fresh sign-in after a backup restore; restoring an older schema also receives the one-time migration sign-out.
New provisioned accounts authenticate exclusively through their provider. Existing enrolled local MFA is always enforced; IdP
acr/amrclaims do not waive it. External group changes are observed at the next verified sign-in; this does not add background directory synchronization or local-factor enrollment for new passwordless accounts.Screenshots
None, per maintainer preference.