Skip to content

feat: run-bound token middleware that takes the run from the token - #23

Merged
TheGreatAxios merged 1 commit into
mainfrom
cl-10968-bind-each-agent-token-to-the-run-it-was-issued-for
Oct 21, 2026
Merged

TheGreatAxios merged 1 commit into
mainfrom
cl-10968-bind-each-agent-token-to-the-run-it-was-issued-for

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

Summary

Add requireRunBoundToken and createRunBoundTokenVerifier: middleware and verifier that bind an agent token to the specific run it was issued for.

  • A token with a runId is only valid for requests to that run
  • The run identity comes from the token, not from a request header
  • Every rejection (missing, invalid, unbound, unknown run, wrong tenant) returns the same 401 { error: "unauthorized" } so responses never reveal whether a token is live
  • Sets both agentToken and workflowRunScope on the Hono context
  • Stacked on feat: run-scoped agent tokens with server-generated values and upsert #22.

Verification

  • bun run check: passes (tsc, oxlint, oxfmt, tests)
  • bun run build: passes

Closes CL-10968

@linear-code

linear-code Bot commented Oct 21, 2026

Copy link
Copy Markdown

CL-10968

@corbits-triage

corbits-triage Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Triage: Pass

No changes needed from you. A maintainer will review this pull request.

Skipped:

Waiting on a maintainer to approve: approve, request review.

@TheGreatAxios
TheGreatAxios deleted the branch cl-10967-require-a-grant-and-server-issued-tokens-on-solution October 21, 2026 03:09
@TheGreatAxios TheGreatAxios reopened this Oct 21, 2026
@TheGreatAxios
TheGreatAxios changed the base branch from cl-10967-require-a-grant-and-server-issued-tokens-on-solution to main October 21, 2026 03:10
Add requireRunBoundToken and createRunBoundTokenVerifier: middleware and
verifier that bind an agent token to the specific run it was issued for.

- A token with a runId is only valid for requests to that run
- The run identity comes from the *token*, not from a request header
- Every rejection (missing, invalid, unbound, wrong-run, wrong-tenant)
  returns the same 401 { error: unauthorized } so responses never reveal
  whether a token is live
- Sets both agentToken and workflowRunScope on the Hono context
- Tests cover the happy path, all rejection cases, and the verifier

Closes CL-10968
@TheGreatAxios
TheGreatAxios force-pushed the cl-10968-bind-each-agent-token-to-the-run-it-was-issued-for branch from 0c28bed to 600d87d Compare October 21, 2026 03:10
@TheGreatAxios
TheGreatAxios merged commit 070f443 into main Oct 21, 2026
2 checks passed
@TheGreatAxios
TheGreatAxios deleted the cl-10968-bind-each-agent-token-to-the-run-it-was-issued-for branch October 21, 2026 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant