Repository navigation
fix(middleware): refuse agent tokens minted by another tenant - #5
Merged
TheGreatAxios merged 2 commits intoSep 27, 2026
Conversation
This was referenced Sep 25, 2026
TheGreatAxios
commented
Sep 25, 2026
TheGreatAxios
left a comment
Contributor
Author
There was a problem hiding this comment.
Self-review: diff matches the linked ticket(s); independent review passes addressed (fixed or waived as noted in the description); typecheck, build and the Postgres-backed suite pass on this branch.
TheGreatAxios
force-pushed
the
cl-9188-agent-token-enforce-tenant-match-in-requireagenttoken
branch
from
September 25, 2026 18:09
6367d2d to
b88617e
Compare
TheGreatAxios
force-pushed
the
cl-9188-agent-token-enforce-tenant-match-in-requireagenttoken
branch
2 times, most recently
from
September 25, 2026 23:49
ecd71b3 to
52e6881
Compare
TheGreatAxios
force-pushed
the
cl-9188-agent-token-enforce-tenant-match-in-requireagenttoken
branch
from
September 25, 2026 23:53
52e6881 to
865941a
Compare
TheGreatAxios
force-pushed
the
cl-9188-agent-token-enforce-tenant-match-in-requireagenttoken
branch
from
September 26, 2026 01:27
865941a to
356c044
Compare
Leaving the tenant comparison to each consuming route made forgetting it a cross-tenant hole.
TheGreatAxios
force-pushed
the
cl-9188-agent-token-enforce-tenant-match-in-requireagenttoken
branch
from
September 26, 2026 01:37
356c044 to
4ecb538
Compare
createAgentTokenVerifier now refuses another tenant's token like requireAgentToken does, and mountAgentTokens reads the tenant from TenantEnv instead of a resolveTenantId option that could disagree.
TheGreatAxios
force-pushed
the
cl-9188-agent-token-enforce-tenant-match-in-requireagenttoken
branch
from
September 27, 2026 01:00
4ecb538 to
b50eb06
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
requireAgentTokenandcreateAgentTokenVerifiershare one tenant check: a token whose tenant differs fromc.get("tenant").idgets the same bare 401, so consuming routes no longer carry their own check.createAgentTokenVerifierreturns a rejected promise rather than throwing synchronously (both tested).mountAgentTokensreads the tenant fromTenantEnv; theresolveTenantIdoption is removed (breaking for hosts that pass it).Verification
bun run typecheck,bun run build: passDATABASE_URL=... bun test --timeout 60000 ./src): 8 pass, 0 fail, including cross-tenant and untenanted casesCloses CL-9188