Repository navigation
KNOX-3600: Prevent CLIENT_ID and delegated tokens from registering other clients - #1531
Merged
Merged
Conversation
Test Results 5 files 5 suites 1m 15s ⏱️ Results for commit 32a77fe. ♻️ This comment has been updated with latest results. |
lmccay
reviewed
Nov 19, 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.
KNOX-3600 - Prevent CLIENT_ID and delegated tokens from registering clients
What changes were proposed in this pull request?
A registered client (
thirdPartyApp=true) authenticates with its own client id as subject. If its token reaches/knoxidf/api/v1/client/register, it registers clients owned by itself, each with its ownknoxidf.knox.token.limit.per.user, so the limit bounds nothing. Revoking the first client leaves the clients it registered working. Likewise, a delegated token (RFC 8693actclaim) lets its actor act for a user at one audience, but at registration it creates a long-lived client owned by that user.RegistrationResource.registerClientrejects, withaccess_denied, right after the anonymous check:reason=client_caller_denied. An unknown id is treated as a user.ActorChainPrincipal, audited asreason=delegated_caller_denied.true;falserestores the previous behaviour:knoxidf.client.registration.client.callers.deniedknoxidf.client.registration.delegated.callers.deniedconfiguration.mdandsecurity.md(dynamic client registration), including the known limits: a deleted client's earlier tokens pass until they expire, and only tokens with anactclaim count as delegated (not impersonation minted without delegated auth, nor passcodes).How was this patch tested?
Unit tests: new
RegistrationResourceClientCallerGuardTest(7 tests) covers a client caller rejected by default and allowed with the opt-out, user callers, non-client token ids, the effective principal after identity-assertion mapping, and no subject or token state. NewRegistrationResourceDelegatedCallerGuardTest(4 tests) covers a delegated caller rejected by default and allowed with the opt-out, a caller without an actor chain, and no subject. All 286gateway-service-knoxidftests pass.Manual test on a local gateway. The
knoxidf-auth-clientregistrationtopology (JWTProvidertrustingKNOXSSO,lowercaseprincipal mapping,thirdPartyApp=true) issues the clients.tokenexchange(KNOXTOKEN+CLIENTID, server-managed) exchanges a client's credentials for a JWT. A test-onlydelegationtopology (JWTProvider,doAsimpersonation for guest,KNOXTOKENwithknox.token.enable.delegated.auth=true) mintsKNOXSSOtokens with anactclaim.Client callers:
{"iss":"KNOXSSO","sub":"guest"}./knoxidf-auth-clientregistration/knoxidf/api/v1/client/register:HTTP 200./tokenexchange/oauth/v1/token(client_credentials):{"iss":"KNOXSSO","sub":"<client 1 id>"}.Results of step 4:
knoxidf.client.registration.client.callers.denied=true:HTTP 403,{"error":"access_denied","error_description":"A registered client cannot register another client."}.knoxidf.client.registration.client.callers.denied=false:HTTP 200, client 2 registered.Delegated callers:
/delegation/knoxtoken/api/v1/token:{"iss":"KNOXSSO","sub":"guest","act":null}.HTTP 200.?doAs=admin):{"iss":"KNOXSSO","sub":"admin","act":{"sub":"guest"}}.Results of step 5:
HTTP 403,{"error":"access_denied","error_description":"A delegated token cannot register a client."}; the audit log hasprincipal=admin|failure|event=client_registration reason=delegated_caller_denied.knoxidf.client.registration.delegated.callers.denied=truewithknoxidf.client.registration.client.callers.denied=false: stillHTTP 403; each flag controls only its own check.Client caller denied (
knoxidf.client.registration.client.callers.denied=true): client 1 cannot register client 2.Client caller opt-out (
knoxidf.client.registration.client.callers.denied=false): client 1 registers client 2.Delegated caller denied (default,
knoxidf.client.registration.delegated.callers.deniedunset): the delegated token cannot register a client.