A negative token_lifetime must still mint an expired auth token - #12
Merged
Merged
Conversation
The presented-token clamp (never outlive the token the agent presented) floors the lifetime at 1s so a nearly-expired presented token cannot produce a negative one. That floor also caught the mock switch a resource-side suite uses to mint an ALREADY-expired auth token and drive its challenge-on-401 path: token_lifetime: -60 issued a token valid for one second, the challenge never fired, and the suite failed with a 200 where it expected a 401. Apply the floor only when the configured lifetime is positive. 233 passing. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CRdau7tgZa1tPVzUdyNrHc
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.
Found while bumping
aauth-proxyfrom mockin 2.0.0 to 3.x.issueAuthTokenclamps the lifetime so an auth token never outlives the token the agent presented (-11 §Auth Token Structure), and floors the result at 1s so a nearly-expired presented token cannot produce a negative lifetime. That floor also catches thetoken_lifetimemock switch when it is set negative — which is how a resource-side suite mints an already-expired auth token to drive its challenge-on-401 path. It got a token valid for one second instead, the challenge never fired, and twoaauth-proxycomponent tests failed with a 200 where they expected a 401.The floor now applies only when the configured lifetime is positive. A deliberately negative one passes through untouched.
One regression test in
test/aauth/token.identity.spec.js. It mints the person token before setting the switch —token_lifetimeshapes the person token too, and an expired presented token is a different (and correct) 400.233 passing.
Note: 3.1.0 (
require_capabilities) went tomainas a direct push rather than a PR. My mistake — flagged to Dick.🤖 Generated with Claude Code
https://claude.ai/code/session_01CRdau7tgZa1tPVzUdyNrHc