You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
security(auth): RS256 authority, run, device and API-key tokens do not check user revocation #20446
Found on #20443. Writing the revocation marker refuses backend login JWTs and SLM HS256 tokens, but these don't check it:
SLM RS256 authority tokens: verify_authority_token in jwks_verifier.py has no epoch lookup, so a password change doesn't revoke them either.
Run-scoped JWTs, device JWTs and LLC agent API keys: they aren't human tokens, and whether one stays valid after its owner is deactivated isn't established.
SLM API keys (get_api_key_user): the code comment says it has no callers, which wasn't verified.
Backend X-Session-ID sessions: no production caller of create_session was found, so none appear to be issued. Not confirmed by running anything.
Acceptance criteria
Each kind is tested after its owner is deactivated, and the result recorded here.
A token that would stay valid is refused, or the issue records why it may.
Correction to this issue: review of #20444 found api/auth.py:132 calls create_session at login, so backend X-Session-ID sessions are issued in production. The "no production caller" line above is wrong. #20444 is covering them.
Would be, but get_api_key_user has no callers (a grep finds only its definition, a docstring and a guard test)
Decision 2
Run JWT
No
Yes
Decision 3
LLC agent API key
No, belongs to agent and company
Yes
Decision 3
Decision 1, device JWTs. (a) On deactivate, set revoked_at on that user's devices; (b) check the user's marker in validate_device_jwt. Recommendation: (b): it also covers password change and needs no write across tables.
Decision 2, SLM API keys. Check is_active and deleted_at in get_api_key_user, or revoke keys on deactivate. Recommendation: the check. It's dormant today and guards the first route that adopts it.
Decision 3, policy: should a deactivated user's agents stop? These credentials carry no user and I found no agent-to-owner link, so stopping them means designing that link first. Recommendation: agents belong to the company and keep running, which is today's behaviour, unless you want otherwise.
From #20444: routes calling get_user_from_request directly, such as knowledge.py and secrets.py, skip the revocation gate for both JWTs and sessions, so a revoked token still reaches them. This predates the work and is read from code, not run. The review counted 23 sync call sites, whose route dependencies were not checked. Add to the criteria here: every such site is checked, and a revoked token is refused there (test).
Maintainer decisions (2026-11-01):validate_device_jwt checks the user's revocation marker. get_api_key_user refuses a key whose user is not active or is deleted. A deactivated user's agents keep running, because they belong to the company, so run JWTs and LLC agent keys need no change. The first two are implemented in #20452, tested against real tokens.
Maintainer correction (2026-11-01), replacing the earlier decision on agents: when a user is deactivated, their agents transfer to another user, the same approach as other content. They do not simply stay as they are. No link from an agent to an owning user was found, so this needs one, reusing the existing transfer path rather than a second one.
Maintainer decision (2026-11-01): when nobody is named, a deactivated user's agents go to the company's other owner or admin, chosen by a fixed rule such as longest-serving, and the audit log names them. An explicit reassign_to overrides it. With no other admin, the agents stay with the deactivated user and show as needing a new owner. The transfer stays inside the company. An owner column is added, set from the verified caller at hire. Filling in existing agents is proposed to the maintainer, not run (#17038).
Maintainer ruling (2026-11-01), replacing the admin-by-rule default above: content is inherited down the chain of command, so a deactivated user's agents and content go to a direct report or a same-role user. Order, as relayed and pending the maintainer's confirmation: direct report first, then same-role user. With several candidates a fixed rule picks one, and the audit log names them. With neither, the content stays and shows as needing a new owner. An explicit reassign_to still overrides, and the transfer stays inside the company.
Maintainer ruling (2026-11-01): user removal is an admin-controlled process. The chain-of-command inheritance is what an admin's removal applies; nothing removes a user or moves their content on its own. The admin sees the proposed recipient and can override it with reassign_to. Open, to report back and not decide: SCIM deprovisioning arrives with no admin at the keyboard. Access can stop while the transfer waits for an admin.
Direct report first, then same-role user, is accepted.
Later replacement: when a replacement for the removed user arrives, an admin must be able to move all of that inherited content to the new user. So each transfer records what came from whom: the interim holder's own content must not move with it, and a second move must work the same way. It stays an admin action with an audit trail.
SCIM: access stops at once and the transfer is pending in a queue.
A hard delete is refused while a user's transfer is unresolved.
Open with the maintainer: whether a deactivated user's agents keep running while a transfer is pending.
Maintainer decision (2026-11-01): a removed user's agents keep running while the transfer waits for an admin, and they show in the queue. Scope in this work: agents, memory and open work-item assignments. Secrets go through the approval queue. A complete table of everything else that carries a user's ownership goes to the maintainer.
Correction (2026-11-01): the recipient recorded above ran the wrong way. "Direct report" meant the person the user reports to. This replaces the earlier order:
Recipient: the removed user's manager, then a same-role user. Someone with no explicit reporting line reports to the CEO by default, so the CEO is their manager. If the removed user is the CEO, there's no one above: same-role, then needing a new owner, reported.
Agents keep working, and the work the removed user did is now done by the manager.
Maintainer direction (2026-11-01), under review before the role move is built: instead of the manager taking the role, the role stays without a user and a temporary agent covers it. Working label, pending the maintainer's confirmation: "Temporary human". It acts as a junior and asks the manager about everything the human used to do: it decides nothing the removed person decided, each such action goes to the manager as a question or approval, and the agents below keep working. The manager does only that manual part and does not take the role. UI text goes through i18n keys. Findings on how this fits the code follow.
Approvals raised by the temporary agent are decided by any company owner or admin, unchanged.
It runs only when woken by an answer or new work, with no periodic heartbeat.
Questions reach the manager as a handoff on the work item; real decisions stay approvals.
To build, with the route fix (security(company-os): work item review and handoff routes trust the identity in the request body #20476) first: a cover record (role, covered user, agent, started, ended, transfer id), vacancy wiring, a verified requester on agent-raised approvals, a cap on open questions per temporary agent, and one hand-over action that gives the replacement the role, ends the cover, moves the agent's open work and ends the agent.
Rotation is proposed according to what the removed person could read, through the approval queue: a removed owner or admin could read every company secret; a non-admin only what they personally held.
Maintainer decision (2026-11-01): the recipient is always an active human. Order: an explicit human manager, or a designated human CEO; otherwise skip the Dispatcher and use a company owner, longest-tenured if several; then a same-role user; then needing a new owner.
PR #20452 landed in the merge train (PR #20560). Refs only; the issue stays open.
Landed on origin/main:
SLM RS256 authority tokens: _rs256_user_is_revoked in autobot-slm-backend/services/jwks_verifier.py (called on the cache-hit path, line 299, and the full-verify path, line 361). Test: services/jwks_verifier_user_revocation_20446_test.py.
Device JWTs: reject_if_owner_revoked in autobot-backend/services/device_owner_revocation.py, with device_owner_revocation_test.py.
SLM API keys: get_api_key_user in autobot-slm-backend/services/auth.py refuses an inactive or deleted owner (if user is None or not user.is_active or user.is_deleted). Test: tests/api/test_api_key_owner_standing_20446.py.
Still open: both acceptance criteria stay unticked. Run-scoped JWTs, LLC agent API keys and the X-Session-ID sessions have no check or recorded result here. The marker was written directly in the tests; it needs another look if #20444 changes how the marker is keyed or stamped. No host check was made.
The shared resolver for this issue is in PR #20574: resolve_successor(session, company_id, user_id) in autobot-backend/llc/services/successor.py, with each step a small helper.
Activity
mrveiss commentedon Nov 1, 2026
Correction to this issue: review of #20444 found
api/auth.py:132callscreate_sessionat login, so backendX-Session-IDsessions are issued in production. The "no production caller" line above is wrong. #20444 is covering them.mrveiss commentedon Nov 1, 2026
Results for each token kind. RS256 ran with a real signed token; the others are from reading the code, not from running them.
X-Session-IDuser_iduser_idget_api_key_userhas no callers (a grep finds only its definition, a docstring and a guard test)Decision 1, device JWTs. (a) On deactivate, set
revoked_aton that user's devices; (b) check the user's marker invalidate_device_jwt. Recommendation: (b): it also covers password change and needs no write across tables.Decision 2, SLM API keys. Check
is_activeanddeleted_atinget_api_key_user, or revoke keys on deactivate. Recommendation: the check. It's dormant today and guards the first route that adopts it.Decision 3, policy: should a deactivated user's agents stop? These credentials carry no user and I found no agent-to-owner link, so stopping them means designing that link first. Recommendation: agents belong to the company and keep running, which is today's behaviour, unless you want otherwise.
mrveiss commentedon Nov 1, 2026
From #20444: routes calling
get_user_from_requestdirectly, such asknowledge.pyandsecrets.py, skip the revocation gate for both JWTs and sessions, so a revoked token still reaches them. This predates the work and is read from code, not run. The review counted 23 sync call sites, whose route dependencies were not checked. Add to the criteria here: every such site is checked, and a revoked token is refused there (test).mrveiss commentedon Nov 1, 2026
Review of #20444 counts 15
get_user_from_requestcallers, correcting the 23 sync sites quoted above. Their route dependencies are still unchecked.security(auth): authority tokens read the backend's Redis markers and…
mrveiss commentedon Nov 1, 2026
Maintainer decisions (2026-11-01):
validate_device_jwtchecks the user's revocation marker.get_api_key_userrefuses a key whose user is not active or is deleted. A deactivated user's agents keep running, because they belong to the company, so run JWTs and LLC agent keys need no change. The first two are implemented in #20452, tested against real tokens.mrveiss commentedon Nov 1, 2026
Maintainer correction (2026-11-01), replacing the earlier decision on agents: when a user is deactivated, their agents transfer to another user, the same approach as other content. They do not simply stay as they are. No link from an agent to an owning user was found, so this needs one, reusing the existing transfer path rather than a second one.
mrveiss commentedon Nov 1, 2026
Maintainer decision (2026-11-01): when nobody is named, a deactivated user's agents go to the company's other owner or admin, chosen by a fixed rule such as longest-serving, and the audit log names them. An explicit
reassign_tooverrides it. With no other admin, the agents stay with the deactivated user and show as needing a new owner. The transfer stays inside the company. An owner column is added, set from the verified caller at hire. Filling in existing agents is proposed to the maintainer, not run (#17038).mrveiss commentedon Nov 1, 2026
Maintainer ruling (2026-11-01), replacing the admin-by-rule default above: content is inherited down the chain of command, so a deactivated user's agents and content go to a direct report or a same-role user. Order, as relayed and pending the maintainer's confirmation: direct report first, then same-role user. With several candidates a fixed rule picks one, and the audit log names them. With neither, the content stays and shows as needing a new owner. An explicit
reassign_tostill overrides, and the transfer stays inside the company.mrveiss commentedon Nov 1, 2026
Maintainer ruling (2026-11-01): user removal is an admin-controlled process. The chain-of-command inheritance is what an admin's removal applies; nothing removes a user or moves their content on its own. The admin sees the proposed recipient and can override it with
reassign_to. Open, to report back and not decide: SCIM deprovisioning arrives with no admin at the keyboard. Access can stop while the transfer waits for an admin.mrveiss commentedon Nov 1, 2026
Maintainer decisions (2026-11-01):
Open with the maintainer: whether a deactivated user's agents keep running while a transfer is pending.
mrveiss commentedon Nov 1, 2026
Maintainer decision (2026-11-01): a removed user's agents keep running while the transfer waits for an admin, and they show in the queue. Scope in this work: agents, memory and open work-item assignments. Secrets go through the approval queue. A complete table of everything else that carries a user's ownership goes to the maintainer.
mrveiss commentedon Nov 1, 2026
Correction (2026-11-01): the recipient recorded above ran the wrong way. "Direct report" meant the person the user reports to. This replaces the earlier order:
mrveiss commentedon Nov 1, 2026
Maintainer direction (2026-11-01), under review before the role move is built: instead of the manager taking the role, the role stays without a user and a temporary agent covers it. Working label, pending the maintainer's confirmation: "Temporary human". It acts as a junior and asks the manager about everything the human used to do: it decides nothing the removed person decided, each such action goes to the manager as a question or approval, and the agents below keep working. The manager does only that manual part and does not take the role. UI text goes through i18n keys. Findings on how this fits the code follow.
mrveiss commentedon Nov 1, 2026
Maintainer decisions (2026-11-01), final design:
security(auth): device JWT honours the owner's revocation marker; API…
mrveiss commentedon Nov 1, 2026
Maintainer decision (2026-11-01): the recipient is always an active human. Order: an explicit human manager, or a designated human CEO; otherwise skip the Dispatcher and use a company owner, longest-tenured if several; then a same-role user; then needing a new owner.
github-actions commentedon Nov 1, 2026
Landed via the merge train (#20560, merge
ce1bcb3f88) via #20452mrveiss commentedon Nov 1, 2026
PR #20452 landed in the merge train (PR #20560). Refs only; the issue stays open.
Landed on
origin/main:_rs256_user_is_revokedinautobot-slm-backend/services/jwks_verifier.py(called on the cache-hit path, line 299, and the full-verify path, line 361). Test:services/jwks_verifier_user_revocation_20446_test.py.reject_if_owner_revokedinautobot-backend/services/device_owner_revocation.py, withdevice_owner_revocation_test.py.get_api_key_userinautobot-slm-backend/services/auth.pyrefuses an inactive or deleted owner (if user is None or not user.is_active or user.is_deleted). Test:tests/api/test_api_key_owner_standing_20446.py.Still open: both acceptance criteria stay unticked. Run-scoped JWTs, LLC agent API keys and the
X-Session-IDsessions have no check or recorded result here. The marker was written directly in the tests; it needs another look if #20444 changes how the marker is keyed or stamped. No host check was made.mrveiss commentedon Nov 1, 2026
The shared resolver for this issue is in PR #20574:
resolve_successor(session, company_id, user_id)inautobot-backend/llc/services/successor.py, with each step a small helper.