fix(auth): elevate allowlisted bunyip admins to super_admin on login #139
Loading…
Reference in a new issue
No description provided.
Delete branch "david/fix/pms-162-bunyip-jit-admin-allowlist"
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?
Bunyip-issued at+jwt access tokens carry no role claim, so the JIT path in
ensure_user_from_bunyipprovisioned every subject asUserRole::default()(Technician) and never re-roled the row afterward. That 403s the admin-gated PSA routes (per-tenant module enable, SLA policy writes) for accounts that ARE listed inOAUTH_SUPER_ADMIN_EMAILS, which is what broke the e2e core-module specs on PR #136 (run #622): auth succeeded but the test account could not enable modules or create an SLA policy.Consult the existing
super_admin_emailsallowlist (already used fail-closed by the Google login path inprovision_user_from_google) from the bunyip path: a never-before-seen allowlisted subject provisions straight as super_admin, and an existing allowlisted row is elevated on each login sinceupsert_user_from_oidc's ON CONFLICT never touches the role. Promotion is idempotent and a no-op for any non-allowlisted user; DB errors degrade to the existing role rather than dropping the session.#PMS-162
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Pull request closed