fix(oidc): OidcVerify routes through UserProvisioningService — invariants restored (#90) #113
No reviewers
Labels
No labels
epic
phase-0
phase-1
phase-2
phase-3
phase-4
phase-5
phase-6
phase-7
phase-8
phase-9
priority/P0
priority/P1
priority/P2
type/backend
type/client
type/docs
type/ops
type/security
type/spike
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
primatekuntech/failsulit!113
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/oidc-verify-invariants"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #90 (M2-audit P0 — the one sign-in surface the M1 fixes never reached).
The bug
/api/auth/oidc/verify's registration branch hand-rolled provisioning: suspended accounts could be linked via any pending invitation (re-entry credential for banned users), the invite claim was check-then-write (double-grant window), TenantId was never granted (invited users landed in no_workspace), and admins minted sessions with no MFA gate.
The fix
The registration branch builds an InviteeIdentity and calls ProvisionInviteeAsync (the shared path — suspended rejection, INV-03 binding, atomic Pending→Accepted claim, TenantId grant via ExecuteUpdate), then applies the SAME admin MFA gate as the existing-login branch: admins with TOTP → mfa-pending session; without TOTP → full session scoped to TOTP setup. Registration responses now carry mfa_required/totp_setup_required like the login path.
Verification
TDD: 4 invariant tests first — RED ×4 (suspended link accepted + invite burned; concurrent accept granted 2 seats from one invitation; TenantId missing; admin MFA skipped) — then migrated.
One test re-scoped during self-review: ConcurrentAccept's HTTP race outcome varies by interleaving on the SQLite shared-connection harness (all DbContexts interleave on one connection); it now pins the INVARIANT (≤1 seat from one invitation, verified via diagnostic dump) instead of the race outcome.
Suite 916 / 0 failed / 39 skipped (Release ×2 + Debug) · coverage gate 86.48% ≥ 80.