Repository navigation
Accept issuer as client assertion audience - #6946
Merged
Merged
Conversation
Before this change only the token endpoint URL was accepted as the aud of a private_key_jwt client assertion. draft-ietf-oauth-rfc7523bis section 4 requires the issuer, so clients following the draft were refused. Accept the issuer alongside the token endpoint URL, as a string or as an array containing either. The audience set is supplied to fosite through a Configurator wrapper built once at startup. Accepting the token endpoint URL, and an aud array with several values, do not meet the draft and are deprecated. A later release will require the issuer as the sole value. JWT-bearer, ID-JAG and SPIFFE JWT-SVID audience checks are unchanged. Refs #6893 Co-authored-by: Mecatl <[email protected]>
jhrozek
requested review from
ChrisJBurns,
JAORMX,
amirejaz,
rdimitrov and
tgrunnagle
as code owners
October 26, 2026 16:15
rdimitrov
approved these changes
Oct 26, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## removed-client-filter #6946 +/- ##
======================================================
Coverage 80.04% 80.05%
======================================================
Files 840 841 +1
Lines 85441 85445 +4
======================================================
+ Hits 68394 68402 +8
+ Misses 17042 17038 -4
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
3 of 10 tasks
jhrozek
added a commit
that referenced
this pull request
Oct 26, 2026
* Stamp clients written from configuration Rows written by ReconcileConfiguredClient now carry a configured stamp: a stored field on Redis and a side map on memory, returned to readers as a marker on the client. Rows written by RegisterClient or the CIMD upsert never carry it, RegisterClient refuses a client that does, and reconcile refuses client types it cannot mark back on read. Startup reconciles configured clients into storage, but nothing ever deletes a removed client's row, so on Redis a delegate removed from config keeps authenticating with its stored secret or keys. Telling those rows apart from rows an embedder wrote itself is the first step to refusing them. Nothing reads the stamp yet, so behaviour is unchanged. Co-authored-by: Mecatl <[email protected]> * Admit configured clients by stamp Removing a delegate client from config did not revoke it. Startup reconciles configured clients into storage, but nothing deletes a removed client's row, so on Redis the client kept authenticating with its stored secret or keys and kept its grants. A new admission layer, ClientAdmissionStorage, sits directly over the caller's storage, below the CIMD and SPIFFE decorators, and overrides only GetClient. It classifies each stored row by what the row shows: a SPIFFE placeholder is never served, a configured row (the stamp, or the legacy delegate shape older releases wrote) is served only while its ID is a configured delegate, and registered (DCR or CIMD) and unmarked rows are always served. A row that does not pass is answered exactly like an unknown client, with one WARN per client ID. Admission never deletes or rewrites a row. The callback's CIMD rate-limit fallback now reads through ClientStoreBelowCIMD, which stops at the admission layer, instead of reaching the raw backend. A test removes clients between two starts on the same Redis and probes every route that takes a client. One token endpoint probe covers all grants, because a second test requires every registered token handler to authenticate the client whenever credentials are present. The route check fails if the router gains a route no probe covers; the pending consent, callback and device verification routes are listed as exempt for now. User-facing: a delegate client removed from config gets invalid_client after a restart, where it used to keep working on Redis. Clients an embedder writes with RegisterClient are served as before, unless they match the legacy delegate shape. The stored row is not deleted; to remove it, DEL the client key. Already-issued access tokens stay valid until they expire. Co-authored-by: Mecatl <[email protected]> * Refuse pending requests for removed clients Client admission hides a removed delegate from every client lookup, but a pending authorization or device request created before the restart only carries a client ID. Consent and the upstream callback fell back to an empty client when the lookup failed, so such a request could still go upstream, and device verification never looked the client up again. Consent, the upstream callback (including its error branch) and the three device verification steps now refuse a pending request whose client no longer resolves, before anything is sent upstream or authorized. buildAuthorizeRequesterFromPending returns the client lookup error instead of continuing without a client, and one shared helper decides what counts as an unresolved client, logged at DEBUG. Storage and transport failures still answer 500. The removal test now probes the consent, callback and device verification routes instead of listing them as exempt. User-facing: a pending consent or upstream callback for a removed client gets a plain-text 400 containing invalid_client, and the device verification page refuses the request. Nothing is sent upstream and the device request is never authorized. Co-authored-by: Mecatl <[email protected]> * Accept issuer as client assertion audience (#6946) Before this change only the token endpoint URL was accepted as the aud of a private_key_jwt client assertion. draft-ietf-oauth-rfc7523bis section 4 requires the issuer, so clients following the draft were refused. Accept the issuer alongside the token endpoint URL, as a string or as an array containing either. The audience set is supplied to fosite through a Configurator wrapper built once at startup. Accepting the token endpoint URL, and an aud array with several values, do not meet the draft and are deprecated. A later release will require the issuer as the sole value. JWT-bearer, ID-JAG and SPIFFE JWT-SVID audience checks are unchanged. Refs #6893 Co-authored-by: Mecatl <[email protected]> * Refuse device confirm without upstream tokens A pending device confirmation without upstream tokens is corrupt data. The confirm step looked up the client with an empty ID, so the user got a "no longer valid" page that blames the device request instead of the stored record. The confirm step now answers 500 for such a record before the client lookup, as it did before the lookup was added. Deny still works, because it runs first. Co-authored-by: Mecatl <[email protected]> --------- Co-authored-by: Mecatl <[email protected]>
This was referenced Oct 26, 2026
Merged
1 task
This was referenced Oct 27, 2026
This was referenced Nov 3, 2026
Authorization server: require the issuer as the only aud of a private_key_jwt client assertion
#7039
Closed
4 of 11 tasks
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
audof aprivate_key_jwtclient assertion. draft-ietf-oauth-rfc7523bis section 4 requires the issuer, so clients that follow the draft gotinvalid_client.aud, as a string or inside an array. The device authorization endpoint accepts the same values. fosite gets the list of accepted audiences through a smallConfiguratorwrapper, built once when the provider is created. The wrapper overrides onlyGetTokenURLs.audchecks for JWT-bearer, ID-JAG and SPIFFE JWT-SVID are unchanged. fosite readsGetTokenURLsonly in client authentication and in its rfc7523 handler, and ToolHive doesn't use that handler.audarray with more than one value, doesn't meet the draft. Both are deprecated, and a later release will require the issuer as the only value.Stacked on #6945. Review only the top commit (
a03d7e30d).Refs #6893
Type of change
Test plan
task test) — not yet run on this branchNew integration test
TestIntegration_PrivateKeyJWTClientAssertionAudienceregisters aprivate_key_jwtclient through DCR. It then sends token-exchange requests with these assertions:aud= issuer: acceptedaud= token endpoint URL: acceptedaud= an unrelated value: refused withinvalid_clienttyp=client-authentication+jwt: acceptedA separate subtest sends an assertion with
aud= issuer to the device authorization endpoint.Does this introduce a user-facing change?
Yes.
private_key_jwtclient assertion whoseaudwas the issuer (for examplehttps://auth.example.com) got401 invalid_client. Onlyhttps://auth.example.com/oauth/tokenwas accepted.audarray with more than one value, is deprecated.Special notes for reviewers
iss == sub == client_id, a valid signature from the client's registered JWKS, and a jti that hasn't been used before.audis compared as an exact string, so an assertion for another issuer on the same host is still refused.*fosite.Config. The client authentication strategy and the endpoint handlers set on that config afterNewOAuth2Providertherefore still reach the provider.400 unauthorized_clientaudarray with more than one value and for a trailing-slash issueraudform🤖 Generated with Claude Code