[ 
https://issues.apache.org/jira/browse/KNOX-3626?focusedWorklogId=1057814&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1057814
 ]

ASF GitHub Bot logged work on KNOX-3626:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 01/Dec/26 10:17
            Start Date: 01/Dec/26 10:17
    Worklog Time Spent: 10m 
      Work Description: smolnar82 merged PR #1557:
URL: https://github.com/apache/knox/pull/1557




Issue Time Tracking
-------------------

    Worklog Id:     (was: 1057814)
    Time Spent: 0.5h  (was: 20m)

> KnoxIDF: Allow the refresh_token grant without client_secret for public 
> (PKCE) clients
> --------------------------------------------------------------------------------------
>
>                 Key: KNOX-3626
>                 URL: https://issues.apache.org/jira/browse/KNOX-3626
>             Project: Apache Knox
>          Issue Type: Improvement
>          Components: KnoxIDF
>            Reporter: Sandor Molnar
>            Assignee: Sandor Molnar
>            Priority: Major
>             Fix For: 3.1.0
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> h3. Problem
> The KnoxIDF authorization server metadata advertises {{"none"}} in 
> {{token_endpoint_auth_methods_supported}}, and the authorization_code grant 
> honours it: a client that presents a valid PKCE {{code_verifier}} gets tokens 
> without a {{client_secret}} ({{TokenResource#validateAuthCode}}).
> The refresh_token grant does not honour it. 
> {{TokenResource#validateRefreshTokenGrant}} always calls 
> {{isValidClientSecret}}, which returns false for a blank secret, so every 
> secretless refresh fails with {{invalid_grant}} ("Invalid grant: client 
> authentication failed", audited as {{reason=validation_failed}}).
> Per RFC 8414, {{token_endpoint_auth_methods_supported}} describes the token 
> endpoint as a whole, not individual grants. A public client that relies on 
> the advertised {{"none"}} method therefore connects successfully, then loses 
> access when its first access token expires (after 
> {{knoxidf.knox.token.ttl}}), because it can never refresh.
> h3. Steps to reproduce
> # Register a client via KnoxIDF client registration.
> # Use it as a public client: authorization_code + PKCE (S256), no 
> {{client_secret}}. The token request succeeds and returns an access token and 
> a refresh token.
> # Call the token endpoint with {{grant_type=refresh_token}}, {{client_id}} 
> and the refresh token, without {{client_secret}}.
> *Expected:* new access token and rotated refresh token.
> *Actual:* HTTP 400 {{invalid_grant}}. The refresh token is valid (enabled, 
> not expired, matching {{client_id}}).
> Workaround: send the {{client_secret}} from the registration response as 
> {{client_secret_post}} on the refresh call.
> h3. Proposed fix
> Removing the secret check unconditionally is not acceptable: it guards 
> against redeeming a stolen refresh token from a confidential client, since 
> the JWTFederationFilter Bearer path forwards to the token endpoint without 
> checking {{client_secret}}. Instead, bind the client-authentication method to 
> the refresh token server-side:
> # On the authorization_code grant, record how the client authenticated (PKCE 
> only vs. {{client_secret}}) in the issued refresh token's metadata, e.g. 
> {{client_auth=none|client_secret_post}}.
> # On the refresh_token grant, skip {{isValidClientSecret}} only when the 
> presented refresh token's stored metadata says {{none}}; otherwise keep 
> requiring the secret. Carry the value forward on every rotation.
> # Never derive this from a request parameter, so a refresh token from a 
> secret-authenticated chain cannot be downgraded to secretless redemption.
> Behaviour for confidential clients is unchanged. Do not remove {{"none"}} 
> from the metadata: the PKCE-only authorization_code path is correct and used.
> h3. Related hardening (can be split out)
> RFC 9700 ยง4.14.2 allows secretless refresh for public clients when refresh 
> tokens are sender-constrained or rotated with reuse detection. KnoxIDF 
> already rotates refresh tokens single-use ({{consumeToken}}), but a replayed 
> token only gets {{invalid_grant}}; the descendant token stays valid. Revoking 
> the refresh-token chain on detected reuse would make the public-client path 
> fully compliant.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to