Repository navigation
fix(authz): widen fulla-admin-console allowlist for delegated admin sign-in - #386
Conversation
…ign-in The AF-01 frontend half (Phase 1+2, #379) requests the nine V045 resource scopes at console sign-in, but the shipped fulla-admin-console client only allowed openid/profile/admin: /oauth2/login dropped every resource scope at the client-allowlist tier, leaving delegated accounts with no admin-class scope and refusing the sign-in end to end. - Widen allowed_scopes to the twelve login scopes in all five server configs and mirror the list in dev_admin_console_client.sql. Existing Postgres deployments backfill the new oauth2_client_scopes rows idempotently at server restart via ClientSeeder (verified locally: a 3-row pre-change DB converged to 12 rows on boot; afterClientRow runs on ON CONFLICT DO NOTHING). - config.dev.json: add the /api/admin/users.* permissions rbac_rules entry, aligning dev with config.json so delegated tokens pass AuthorizationFilter out of the box. ci/prod/bench stay operator opt-in (ci is memory-storage, where delegated accounts cannot exist). - auth.ts: refresh the CONSOLE_LOGIN_SCOPE comment; the shipped allowlist now covers all twelve names, entitlements alone decide the issued set. - AdminRbacEnforcementHttpTest: exercise the red line through the SHIPPED client - a users:read-only helpdesk account gets exactly openid/profile/users:read (read users OK, everything else 403); an unprivileged account obtains no admin-class scope; the admin role's own sign-in carries all twelve scopes and still passes the family gate. Fixes #375
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Review — no blocking issues; one important test-robustness noteThe change itself looks correct and internally consistent:
Important — leg 8 bypasses the suite's login hardening. loginForClient("admin", "admin", "fulla-admin-console", kFullConsoleScope);is the only admin login in the suite that goes through the raw
Minor (non-blocking): the |
Summary
Closes #375: the AF-01 delegated-administration sign-in was rejected end to end because the shipped
fulla-admin-consoleOAuth2 client allowed onlyopenid profile admin, so/oauth2/logindropped all nine V045 resource scopes at the client-allowlist tier and every delegated account was issued no admin-class scope (all console probes 403).allowed_scopesto the twelve login scopes in all five server configs (config.{json,dev.json,prod.json,ci.json,bench.json}); mirror the list inapps/server/seed/dev_admin_console_client.sql.config.dev.jsongains the"/api/admin/users.*": { "permissions": ["users:read"] }entry, aligning dev withconfig.json(dev is Postgres-backed and is the stack delegated sign-in is exercised on).ci/prod/benchstay operator opt-in: ci is memory-storage where delegated accounts cannot exist (role→permission resolution falls back to the compile-time map with no permission rows), and prod/bench are deployment choices.frontends/admin/src/stores/auth.ts: theCONSOLE_LOGIN_SCOPEcomment now states the shipped allowlist covers all twelve names and entitlements alone decide the issued subset (narrowing it back re-enables the client-tier drop).AdminRbacEnforcementHttpTest.cc: three new legs exercise the red line through the shipped client (in addition to the existing dynamic-client legs), plus aintrospectGrantedScopehelper.ClientSeeder backfill (issue AC #2, verified locally)
Against an existing Postgres DB whose
oauth2_client_scopesstill held the pre-change 3-row shape, one server boot with the widened config converged it to 12 rows —ClientSeeder: client 'fulla-admin-console' already present, left untouched(theafterClientRowpath runs onON CONFLICT DO NOTHING), with existingoauth2_clientsfields unaltered. Fresh databases get the same list via the updated seed SQL. Note: the test binary does not run the seeder (it is wired inapps/server/src/main.ccbootstrap only) — CI's Postgres-backed suite relies on the seeded DB, which is why the seed SQL change is load-bearing there.Validation
Integration_P1_Rbac_HelpdeskRedLine_AllThreeGates(now 58 assertions incl. the three new legs): all pass locally against Postgres — helpdesk (users:read-only) viaclient_id=fulla-admin-consolereceives exactlyopenid profile users:read, reads/api/admin/users(200), gets 403 on other admin families; an unprivileged account obtains no admin-class scope; the admin role's sign-in carries all twelve scopes and still passes the catch-all gate.Integration_P1_Rbac_NegativeLine_UserRoleGrantNoGateCollapse: all pass (13 assertions).openid profile admin, so the widened allowlist does not change any other token's scope.Fixes #375