Repository navigation
Define exchange grant authorization details type - #6990
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6990 +/- ##
========================================
Coverage 80.32% 80.32%
========================================
Files 848 849 +1
Lines 86492 86597 +105
========================================
+ Hits 69472 69557 +85
- Misses 17015 17035 +20
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
jhrozek
marked this pull request as ready for review
October 29, 2026 11:03
jhrozek
requested review from
ChrisJBurns,
JAORMX,
rdimitrov and
tgrunnagle
as code owners
October 29, 2026 11:03
ChrisJBurns
previously approved these changes
Oct 29, 2026
jhrozek
force-pushed
the
exchange-client-config-restack
branch
from
October 29, 2026 20:53
de1d0da to
cc7f5fb
Compare
jhrozek
force-pushed
the
exchange-authdetails
branch
from
October 29, 2026 20:53
bb2b6ef to
0de8cc1
Compare
jhrozek
requested review from
amirejaz,
aponcedeleonch and
reyortiz3
as code owners
October 29, 2026 22:35
A confidential client run by an operator, such as an agent broker, must keep acting for a user after that user's login has ended, for example in scheduled background work. Its access token is short-lived and tied to the login, so it cannot do this alone. The planned mechanism exchanges the user's access token, through RFC 8693, for a client-bound refresh token. The exchange request has to say what the grant may produce and for how long, so this defines that request as an RFC 9396 authorization_details type and the rules applied to it. The type, https://toolhive.dev/exchange_grant, has three members: type, issuable_token_types (one ID-JAG or refresh-token URN), and an optional integer expires_at. Unknown members are refused, and a request carries exactly one such entry. The lifetime comes from the operator's policy per client and token type, not from the user's access-token expiry, because the grant must outlive that token (RFC 8693 section 2.2.1). A missing expires_at takes the cap, and a larger one is cut down to it (RFC 9396 section 7.1). A child grant cannot be a refresh token and cannot outlive its parent. The repeated-parameter error now comes from one constructor shared with the existing handler, with no change in behaviour. Nothing calls these rules yet; the handler arrives in a later change. Known limits: the grant is not yet bound to an audience or resource (RFC 9700 section 4.14.2, deferred). There is no inactivity expiry, so only the hard cap applies. Consent is not checked yet; the handler will require offline_access. Co-authored-by: Mecatl <[email protected]>
jhrozek
force-pushed
the
exchange-authdetails
branch
from
October 30, 2026 06:25
332b53c to
e5fb419
Compare
aponcedeleonch
approved these changes
Oct 30, 2026
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
Why: an operator-run confidential client, such as an agent broker, must keep acting for a user after that user's login has ended, for example in scheduled background work. Its access token is short-lived and tied to the login, so it cannot do this alone. The planned mechanism exchanges the user's access token, through RFC 8693, for a client-bound refresh token. The exchange request has to say what the grant may produce and for how long.
What:
authorization_detailstypehttps://toolhive.dev/exchange_grantand a private registry that holds only this type.expires_atfilled in or capped (RFC 9396 §7.1). A child grant derived from an existing grant cannot be a refresh token and cannot outlive its parent.Nothing calls these rules yet. The handler that uses them arrives in a later change.
Refs #6897
Type of change
Test plan
task test): not run. I rango test -race ./pkg/authserver/server/tokenexchange/on the package, plusgo vetandgofmt, all clean.task test-e2e)task lint-fix): not run; left to CI.Does this introduce a user-facing change?
No. Nothing calls this code yet, so requests behave as they do today.
Special notes for reviewers
exchange-client-config-restack(Add exchange refresh token client config #6989). Merge order: Limit delegate token exchange to source clients #6988, then Add exchange refresh token client config #6989, then this PR. The diff shows only this commit.locations, and it is a known deviation from that MUST.exp. This is deliberate for offline use (RFC 8693 §2.2.1). The subject's expiry only sets how long its replay marker is kept.offline_accessin the subject token.authorization_detailsreturnsinvalid_request(RFC 6749 §5.2), notinvalid_authorization_details.authorization_detailstype on session open. The single-type registry refuses that. This needs a decision before the handler lands.https://toolhive.dev/exchange_grant. Some design docs still show older URIs.