Skip to content

feat(auth): add OIDC account linking and role policies - #344

Merged
RentnerKev merged 4 commits into
mainfrom
rentner/feat/oidc-account-policy
Nov 3, 2026
Merged

RentnerKev merged 4 commits into
mainfrom
rentner/feat/oidc-account-policy

Conversation

@RentnerKev

@RentnerKev RentnerKev commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

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

  • New feature
  • Bug fix

Testing

  • Generated migration using bun --no-env-file run db:generate and 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 0600 stat reporting; three unchanged own-image dependency tests hit Git Bash's unsupported ulimit -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

  • I tested the relevant functionality.
  • The entire existing suite passes on this host: the 10 unchanged Windows/MSYS fixture failures are documented above.
  • I added or updated tests where appropriate.
  • This PR does not include real secrets, credentials, production data, or private certificates/keys.
  • No additional documentation files or screenshots were added, per maintainer preference.
  • I linked the relevant issue.

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/amr claims 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.

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between 1675c23 and 8f12072.

Files ignored due to path filters: 1
  • web/src/routeTree.gen.ts is excluded by !**/routeTree.gen.ts
Files selected for processing: 73
  • .github/scripts/ci/beta2/Types/diagnostics.types.ts
  • .github/scripts/ci/beta2/diagnostics.ts
  • .github/scripts/ci/beta2/journeys.ts
  • .github/scripts/ci/fixtures/managed-backup-probe.ts
  • .github/scripts/ci/fixtures/persistence/storage.ts
  • scripts/backup/restore-session-continuity.ts
  • web/drizzle/0032_worried_landau.sql
  • web/drizzle/meta/0032_snapshot.json
  • web/drizzle/meta/_journal.json
  • web/src/config/oidc.config.ts
  • web/src/db/Schema/auth.ts
  • web/src/db/Schema/users.ts
  • web/src/features/Admin/AuditLogs/validation.ts
  • web/src/features/Admin/OidcProviders/Types/oidc-providers.types.ts
  • web/src/features/Admin/OidcProviders/validation.ts
  • web/src/lib/Admin/AuditLogs/Types/audit-events.types.ts
  • web/src/lib/Admin/AuditLogs/auditLogs.ts
  • web/src/lib/Auth/Oidc/Types/oidc-provider.types.ts
  • web/src/lib/Auth/Oidc/validation.ts
  • web/src/lib/Language/Locales/de.json
  • web/src/lib/Language/Locales/en.json
  • web/src/lib/Language/Locales/es.json
  • web/src/lib/Language/Locales/fr.json
  • web/src/lib/Language/Locales/it.json
  • web/src/lib/Language/Locales/nl.json
  • web/src/lib/Language/Locales/pl.json
  • web/src/lib/Language/Locales/pt.json
  • web/src/routes/api/auth/oidc/connections.ts
  • web/src/server/Admin/UserManagement/users.service.ts
  • web/src/server/Auth/Access/sessions.service.ts
  • web/src/server/Auth/Oidc/Types/oidc-connections.types.ts
  • web/src/server/Auth/Oidc/Types/oidc-flow.types.ts
  • web/src/server/Auth/Oidc/Types/oidc-response.types.ts
  • web/src/server/Auth/Oidc/Types/oidc.types.ts
  • web/src/server/Auth/Oidc/oidc-accounts.service.ts
  • web/src/server/Auth/Oidc/oidc-authentication.server.ts
  • web/src/server/Auth/Oidc/oidc-claims.server.ts
  • web/src/server/Auth/Oidc/oidc-client.server.ts
  • web/src/server/Auth/Oidc/oidc-connections-response.server.ts
  • web/src/server/Auth/Oidc/oidc-linking.service.ts
  • web/src/server/Auth/Oidc/oidc-login.service.ts
  • web/src/server/Auth/Oidc/oidc-providers.service.ts
  • web/src/server/Auth/Oidc/oidc-response.server.ts
  • web/src/server/Auth/Oidc/oidc-session.server.ts
  • web/src/server/Auth/Oidc/oidc-settings.server.ts
  • web/src/server/Auth/Oidc/oidc-state.server.ts
  • web/src/server/Auth/PasswordReset/password-reset.service.ts
  • web/src/server/Auth/Setup/invites.service.ts
  • web/src/server/Auth/TwoFactor/two-factor.service.ts
  • web/src/server/Backups/restore-maintenance.server.ts
  • web/src/server/Valkey/auth-challenges.service.ts
  • web/src/tests/features/Admin/AuditLogs/validation.test.ts
  • web/src/tests/features/Admin/OidcProviders/validation.test.ts
  • web/src/tests/server/Auth/Access/Fixtures/sessions-maintenance.fixture.ts
  • web/src/tests/server/Auth/Access/sessions-maintenance.test.ts
  • web/src/tests/server/Auth/Login/login-state.test.ts
  • web/src/tests/server/Auth/Oidc/oidc-account-policy.db.test.ts
  • web/src/tests/server/Auth/Oidc/oidc-account-policy.test.ts
  • web/src/tests/server/Auth/Oidc/oidc-authentication.db.test.ts
  • web/src/tests/server/Auth/Oidc/oidc-claims.test.ts
  • web/src/tests/server/Auth/Oidc/oidc-client.test.ts
  • web/src/tests/server/Auth/Oidc/oidc-connections-response.test.ts
  • web/src/tests/server/Auth/Oidc/oidc-login-flow.test.ts
  • web/src/tests/server/Auth/Oidc/oidc-provider-api.db.test.ts
  • web/src/tests/server/Auth/Oidc/oidc-providers-service.test.ts
  • web/src/tests/server/Auth/Oidc/oidc-providers.test.ts
  • web/src/tests/server/Auth/Oidc/oidc-response.test.ts
  • web/src/tests/server/Auth/Oidc/oidc-session.test.ts
  • web/src/tests/server/Valkey/auth-challenges.test.ts
  • web/src/tests/tooling/docker/production/backup-restore.test.ts
  • web/src/tests/tooling/github/beta2-diagnostics.test.ts
  • web/src/tests/tooling/github/persistence-fixture.test.ts
  • web/src/tests/tooling/scripts/backup/restore-session-continuity.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@RentnerKev
RentnerKev merged commit 0464b00 into main Nov 3, 2026
36 checks passed
@RentnerKev
RentnerKev deleted the rentner/feat/oidc-account-policy branch November 3, 2026 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(auth): add explicit OIDC account linking and group-to-role mapping

1 participant