test(auth): lock in bootstrap-admin login without email verification (PMS-676) #462
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/PMS-676-bootstrap-admin-unverified-login"
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?
Implements PMS-676 (prerequisite investigation: PMS-637). Direction confirmed with the ticket owner: target the production bootstrap path (bunyip-as-OP), not the DEV-only env seed.
Finding
The ticket's premise ("the admin flow currently requires verifying the admin email before granting access, so on a fresh instance the admin can never get in") does not reproduce against current code. There is no email-verification gate on admin login:
bunyip_role = "admin"maps to mokoshsuper_admininplace_bunyip_user(src/modules/auth/middleware.rs,effective_role_from_bunyip), and that path returns an authenticated session regardless ofemail_verified. An unverified address only skips invite consumption and stores a<sub>@unresolved.invalidplaceholder; it never blocks login or the super_admin grant.service.rs::login) has noemail_verifiedgate either, and the DEVADMIN_EMAIL/ADMIN_PASSWORDseed creates its row pre-verified.RequireVerifiedextractor and noemail_verified_at-based 403 anywhere in the request path.BOOTSTRAP_ADMIN_EMAIL"first matching login becomes admin" flow described in standup does not exist in code; onlyADMIN_EMAIL/ADMIN_PASSWORD(DEV-only startup seed) andOAUTH_SUPER_ADMIN_EMAILS(Google exact-email auto-provision) do.So there is no gate to remove. This PR pins the behaviour with regression tests and documents first-run onboarding, which is the actual deliverable.
Changes
tests/bunyip_login.rs:bootstrap_admin_unverified_email_still_gets_super_admin(email_verified = false, standing in for SMTP-unconfigured, still yieldssuper_admin+ an authenticated session) andbootstrap_admin_verified_email_still_gets_super_admin(email_verified = truedoes not downgrade the admin).docs/first-run-onboarding.md: end-to-end first run - spin up, sign in as the bootstrap admin via the bunyip platform-admin claim (no verification), configure email viaPUT /api/v1/settings/email(admin-only, hot-swaps the mailer, PMS-638), then invite the team who verify normally. Also documents the DEV-only local seed as distinct from production.Acceptance criteria
place_bunyip_user).docs/first-run-onboarding.md).Verification
cargo test --test bunyip_login: 11 passed.cargo fmt --all --checkclean,cargo clippy --test bunyip_loginclean.