Skip to content

security(auth): RS256 authority, run, device and API-key tokens do not check user revocation #20446

Open
1 of 1 issue completed

Description

@mrveiss

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.

Activity

  1. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    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.

  2. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    Results for each token kind. RS256 ran with a real signed token; the others are from reading the code, not from running them.

    Kind Names a person? Valid after that person is deactivated? State
    SLM RS256 authority token Yes Was valid Fixed in the PR linked below
    Backend X-Session-ID Yes Yes, 30-minute sliding lifetime Being fixed in #20444
    Device JWT Yes, user_id Yes Decision 1
    SLM API key Yes, user_id 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.

  3. added
    needs-decisionBlocked on an owner decision; options and a recommendation are on the issue
    on Nov 1, 2026
  4. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    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).

  5. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    Review of #20444 counts 15 get_user_from_request callers, correcting the 23 sync sites quoted above. Their route dependencies are still unchecked.

  6. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    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.

  7. removed
    needs-decisionBlocked on an owner decision; options and a recommendation are on the issue
    on Nov 1, 2026
  8. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    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.

  9. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    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).

  10. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    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.

  11. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    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.

  12. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    Maintainer decisions (2026-11-01):

    • 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.

  13. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    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.

  14. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    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.
    • The subtree moves as one piece: agents, skills, tools and secrets. Secrets in it need rotation, which is only proposed through the human approval queue (Umbrella: SLM Data hygiene page — detect and safely clean up orphaned data across services #17038); no agent does it.
    • The admin confirmation and the later move to a replacement stand, and the replacement move takes the same subtree.
  15. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    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.

  16. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    Maintainer decisions (2026-11-01), final design:

    • 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.
  17. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    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.

  18. github-actions commented on Nov 1, 2026

    @github-actions
    Contributor

    Landed via the merge train (#20560, merge ce1bcb3f88) via #20452

  19. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    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.

  20. mrveiss commented on Nov 1, 2026

    @mrveiss
    OwnerAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions