Sandor Molnar created KNOX-3600:
-----------------------------------
Summary: Prevent CLIENT_ID tokens from registering other clients
Key: KNOX-3600
URL: https://issues.apache.org/jira/browse/KNOX-3600
Project: Apache Knox
Issue Type: Improvement
Components: KnoxIDF
Reporter: Sandor Molnar
Assignee: Sandor Molnar
Fix For: 3.1.0
*Problem*
A registered client (a CLIENT_ID token with {{{}thirdPartyApp=true{}}})
authenticates with its own client id as subject. Such a token can reach
{{/knoxidf/api/v1/client/register}} this way: {{client_credentials}} at a
server-managed topology, then a same-subject token exchange at a topology the
registration topology trusts. The client then registers a new client owned by
itself. That client gets its own {{knox.token.limit.per.user}} and can do the
same, so the limit bounds nothing. Revoking the first client leaves all the
clients it created working.
*Fix*
In {{{}RegistrationResource.registerClient{}}}, right after
{{{}anonymousRegistrationDenied(){}}}: if the caller's subject is the id of a
CLIENT_ID token, reject with {{access_denied}} and audit
{{{}reason=client_caller_denied{}}}.
* New KNOXIDF service param
{{{}knoxidf.client.registration.client.callers.denied{}}}, default
{{{}true{}}}. Setting {{false}} restores today's behaviour.
* Check the raw subject ({{{}SubjectUtils.getPrimaryPrincipalName{}}}), not
the effective principal. Identity-assertion mapping such as {{lowercase}} would
hide a mixed-case user-supplied client id.
* {{{}tokenStateService.getTokenMetadata(subject){}}}: reject if
{{{}isClientId(){}}}. Unknown id: not a client.
*Known limit*
A deleted client's already-exchanged token passes until it expires, because its
metadata is gone and it looks like a user.
*Tests*
* CLIENT_ID subject: rejected and audited. With the param set to
{{{}false{}}}: registered.
* User subject: registered.
* Mixed-case client id under {{lowercase}} mapping: rejected.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)