fix(tokens): only a plain api key may delegate an assertion scope
Merged
KH
13d ago+138+138+012345678901234567890123456789-14-14-01234567890123456789
Summary
Follow-up to #114, addressing review thread https://github.com/AgentWorkforce/relayauth/pull/114#discussion_r4429643545.
Delegating an assertion scope (through POST /v1/api-keys or POST /v1/tokens/workspace) now requires the caller to be a plain API key that holds the exact literal. Bearer tokens and workspace tokens do not qualify, because their scopes can be assigned within an org. Broker keys are provisioned out of band (bootstrap file or operator insert), so the assertion tests now seed them directly.
Verification
packages/servernpm test: 694/694 pass.tsc --noEmit(afterturbo build): clean.- Reverting the credential check fails the new bearer-delegation test.
🤖 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
claudesessiona685ac1e· opened viagh pr create· last active 2026-10-31