fix(tokens): require the exact broker scope to mint History assertions
Merged
KH
13d ago+183+183+012345678901234567890123456789-2-2-0123456789
Summary
Tighten scope checks on the History assertion route. Workspace tokens and admin keys can no longer satisfy the assertion scope by implication.
- New
lib/broker-scopes.ts: an assertion scope is satisfied only by its exact literal. - The History assertion route authorizes with that exact matcher and accepts only a plain api-key credential.
- API key and workspace token issuance refuse to delegate an assertion scope unless the caller holds that exact literal.
Found in the 2026-10-30 security sweep.
Verification
packages/servertests: all pass (691/691 at merge).- Reverting the route changes (tests kept) fails the new tests.
npx turbo build && npx turbo typecheck: clean.
🤖 Generated with Claude Code
![View with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3-3x.png)
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Need help on this PR? Tag @codesmith-bot with what you need.
Agent Relay sessions