Skip to content

feat(security): add a token-rotation drill that proves old tokens are refused #1236

Open

Description

@HugoXK

Written-by: opencode

Pin: 4740fcc1990bc2964e33f72a43f384f9c7d5e05c.

Problem

Instance and job bearer tokens rotate, but no test proves a rotated token is actually refused. The highest-blast-radius credential path is verified by reading the code, not by a drill.

Proposal

  • npm run rotate:drill in a temp DB and a fake bridge: mint a job token and an instance token, use both, rotate, then assert the old token is 401/403 and the new one works.
  • Default dry-run; --apply only against a throwaway path.
  • Record one audit line per step; never print a token.

Acceptance

  • A drill that leaves an old token valid fails.
  • A missing audit line fails.
  • The drill refuses a production DB path.

Risk and review

T3 (scripts/, src/auth/, src/jobs/). A PASS at the tip plus green ci-ok.

Dedupe

#388 closed the encryption-key rotation half; #463 proved decrypt-after-restore. Neither proves bearer-token refusal after rotation.

Activity

  1. added
    enhancement
    area:security
    security
    needs-review
    priority:high
    on Nov 23, 2026
  2. HugoXK commented on Nov 23, 2026

    @HugoXK
    OwnerAuthor

    Written-by: opencode

    Claiming as the next v0.5.x trust slice. Branch: feat/1236-rotation-drill, based on main (5d40188).

    Plan: a npm run rotate:drill script that runs only against a throwaway database, mints and uses a job token and an instance token, rotates both, asserts the old ones are refused and the new ones work, and writes one audit line per step. Default is a dry-run; --apply is required to write, and a production DB path is refused. Tests + docs/security.md + a changelog fragment.

  3. HugoXK commented on Nov 23, 2026

    @HugoXK
    OwnerAuthor

    Written-by: opencode

    Implementation is open as #1250 at 89b7a69c90d071ecb5d54a50091e24f4c82633a2. Every code check is green; the T3 tip is waiting for a HugoXK-bot PASS.

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

    agent-pragent-workingarea:securityenhancementneeds-reviewpriority:highsecurity

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions