Repository navigation
Open
Labels
backendbugSomething isn't workingSomething isn't workingphase:M3.9Chat, Agents, Analytics and Settings screensChat, Agents, Analytics and Settings screenspriority: high
Milestone
Description
Corrected 2026-11-02. This issue first said a demoted admin keeps access until their token expires. That was wrong: there is no demotion to go stale. From reading the code on main; not run.
Problem
The role routes and admin access are disconnected, in both directions.
- The token's
rolecomes only fromis_platform_admin(api/auth.py:105), and refresh copies it forward (auth.py:513-518). - No route changes
is_platform_adminafter an account is created. The only writers are the first-admin seed and the create path (user_management/services/seed.py:110,user_service.py:78,98). POSTandDELETE /{user_id}/roles/{role_id}andPUT /{user_id}/role(api/user_management/users.py:392,421,458) writeUserRolerows only. Those feed live permission checks, never the token.
So an admin who revokes another user's "admin" role changes nothing on token-role checks such as require_transcriber_admin, even after a fresh login, and an admin can't be demoted at all. Giving a user admin through PUT /{user_id}/role grants no token admin either. A person using those routes would reasonably believe they had changed who is an admin.
Paths checked
| Path | Affects token role? |
|---|---|
| The three role routes above, and role ids at creation | No |
is_platform_admin at creation |
Yes, only then |
update_user (user_service.py:229) |
No role field |
Deactivation and deletion (user_service_lifecycle.py:111) |
Already revokes tokens through the epoch (#20443) |
Company role definitions and assignments (llc/api/roles.py, llc/services/membership_service.py) |
Company-scoped; not traced into admin status |
| SCIM and SSO in the main backend | None found, beyond a read-only SSO audit |
Decision needed
What does changing someone's admin status mean?
- A (recommended):
is_platform_adminis the one source of admin, changed only through a new admin route. In the same transaction it queuesPasswordEpochMarkwith lead 0 (autobot_shared/user_management/password_epoch.py), so old tokens stop on the next request, failing closed if Redis is down. The role routes stay permissions only, and the screens say so. No new store. A self-demoting admin is signed out and returns as a normal user. - B: derive the token's role from
UserRoleat login, and have the role routes bump the epoch. This changes who counts as admin at every gate, andis_platform_adminbecomes redundant or needs reconciling. - C: read the role live in
get_current_user. A database read on every request, reintroducing the dependencydependencies.py:168-175avoids. Not recommended.
Acceptance criteria
- The decision is recorded here.
- An admin can change a user's admin status, and it takes effect on the next request.
- A test through a real admin route such as
PATCH /providers: a token from before the change is refused, with an unchanged-admin control, a promotion case, and the Redis-down fail mode. - The user management screens don't imply a role route changes admin status, if the decision keeps them separate.
- Host evidence after a finished builtin update.
Metadata
Metadata
Assignees
Labels
backendbugSomething isn't workingSomething isn't workingphase:M3.9Chat, Agents, Analytics and Settings screensChat, Agents, Analytics and Settings screenspriority: high
Activity
[-]security(auth): a demoted admin keeps admin access until their token expires[/-][+]security(auth): admin status can't be changed, and the role routes don't affect it[/+]mrveiss commentedon Nov 2, 2026
Maintainer decision (2026-11-02): option A.
is_platform_adminis the one source, changed through a new admin route that also revokes old tokens through the existing password epoch. No new store; the role routes stay permissions only. The implementation PR waits for the merge coordinator to ask.fix(auth): one route changes platform admin status and revokes old to…
fix(auth): a repeated demotion finishes the revocation a 503 left und…
fix(auth): repeat a demotion's revocation only while it is unconfirmed (
fix(user-management): admin-status revision under the row lock, app c…
ci(migration-gate): trigger on the user-management modules the admin-…
8 remaining items
Merge origin/main into issue-18208-one-ci-workflow; port #20670 migra…
mrveiss commentedon Nov 15, 2026
Closure pass, checked against
origin/mainatc2b5a4fa95. I read the code; I ran no tests. The work landed in #21020 (merge8e6ba8f15b), which follows option A.autobot-backend/api/user_management/admin_status.py:31PUT /user-management/users/{user_id}/admin, gated byrequire_platform_admin(:40), mounted inapi/user_management/router.py:23.autobot_shared/user_management/user_service_lifecycle.py:213set_platform_adminqueuesPasswordEpochMark(:256), with lead 1 on demotion and 0 on promotion (:56).tests/security/test_admin_status_20670.py:79test_revoking_admin_voids_the_old_admin_token_on_the_next_requestPATCH /providers: old token refused, unchanged-admin control, promotion, Redis-downget_current_userdirectly (_assert_refused), not through an HTTP request to a real admin route. The only HTTP test (:212) checks the 403 gate on the new route withget_current_useroverridden.autobot-frontend/src/views/AdminUsersView.vue:63-78shows a Role select that includesadmin(src/constants/roles.ts:44ASSIGNABLE_ROLES = ['admin', 'user', 'readonly']), and its change handler callsPUT /api/user-management/users/{id}/role(:438). That is the role route, which per the decision does not change admin status. No frontend caller of the new/adminroute was found.c2b5a4fa95(it includes8e6ba8f15b; the update finished withfailed=0), andadmin_status.pyis deployed. No admin-status change shows in the install's backend logs, and making one is a write, which a read-only check cannot do.Still needed: an HTTP-level revocation test through a real admin route; screen wording, or a switch to the
/adminroute for the admin choice; host evidence of a demotion refusing an old token. The issue stays open.fix(auth): admin status retry keeps its value; role select uses the k…
fix(auth): admin status styles move to the shared stylesheet (#20670)
fix(auth): record the class-name count the style move lowered (#20670)
github-actions commentedon Nov 16, 2026
Landed via the merge train (#21658, merge
7e54fc095d) via #21648mrveiss commentedon Nov 16, 2026
Closure pass against origin/main 7e54fc0 (train #21658).
Ticked:
autobot-backend/tests/security/test_admin_status_20670.pytest_demoting_through_the_route_refuses_the_old_admin_token_on_a_real_admin_route(control 200 before,PUT /user-management/users/{id}/admin, old token 401, another admin's token 200) andtest_promoting_through_the_route_voids_the_old_token_and_the_next_login_reaches_admin_routes. The Redis-down fail mode istest_a_store_that_cannot_record_is_a_503_and_the_change_stays_committed(same file), exercised at the service layer, not over HTTP.autobot-frontend/src/constants/roles.ts:46ASSIGNABLE_ROLES = ['user', 'readonly'];components/admin/UserRoleSelect.vue:5-7states roles change permissions only andadminis not offered; admin status has its own control,components/admin/AdminStatusControl.vue.Left: host evidence after a finished builtin update. The install's recorded deployed commit is c2b5a4f, which does not include 7e54fc0. Awaiting a builtin update to 7e54fc0 or later.
mrveiss commentedon Nov 16, 2026
Unticked the real-route test AC. On main (7e54fc0),
test_admin_status_20670.pycovers three cases through the realPUT /user-management/users/{id}/adminroute and a real admin route (#21648): the old-token refusal, the unchanged-admin control, and promotion. The Redis-down fail mode that this AC also asks for is tested only at the service layer, not through the route. Remaining: an HTTP-level test where the epoch store is down, asserting the route's 503 and that the change stays committed.test(auth): admin status route under a store that cannot record and o…
fix(auth): admin status gets its own control and an HTTP revocation t…
github-actions commentedon Nov 16, 2026
Landed via the merge train (#21663, merge
bbd78c1a0d) via #21659mrveiss commentedon Nov 16, 2026
Closure check against origin/main at bbd78c1 (merge of #21663, via #21659). Real-route test AC ticked; the host AC stays open.
autobot-backend/tests/security/test_admin_status_20670.py, through the realuser_managementrouter behind the real credential gate (_client, line 325):test_demoting_through_the_route_refuses_the_old_admin_token_on_a_real_admin_route(line 351): pre-change token 200, then 401 after the change; another admin's token still 200.test_promoting_through_the_route_voids_the_old_token_and_the_next_login_reaches_admin_routes(line 369).test_a_store_that_cannot_record_makes_the_route_a_503_and_the_change_stays_committed(line 388).test_a_store_that_is_down_refuses_the_caller_at_the_gate_and_the_change_never_runs(line 411).Host AC left unticked: awaiting a builtin update to bbd78c1 or later (the deployed commit does not include it).
test(auth): admin status revocation fails closed through the real rou…
mrveiss commentedon Nov 17, 2026
Host check after the builtin update to main @ b43fe28 (read-only):
AdminStatusControl.vue) and test(auth): admin status revocation fails closed through the real route when the store is down (#20670) #21659 (tests/security/test_admin_status_20670.py).AC "Host evidence after a finished builtin update" stays unticked. This shows the code is deployed and healthy. It does not show the revocation behaviour. Proving that needs a live admin-status change on the host, where a token issued before the change is refused. That changes a real user's admin standing, so it needs the owner to run it or approve it. Not attempted.
mrveiss commentedon Nov 21, 2026
Read-only check of the local install on 2026-11-21 (install at main d8cbd91). No data was changed.
PUT /api/user-management/users/{id}/adminis served and returns 401 unauthenticated.