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

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

                Author: ASF GitHub Bot
            Created on: 30/Jul/26 10:37
            Start Date: 30/Jul/26 10:37
    Worklog Time Spent: 10m 
      Work Description: github-actions[bot] commented on PR #1334:
URL: https://github.com/apache/knox/pull/1334#issuecomment-5129748744

   ## Test Results
   40 tests   40 ✅  6s ⏱️
    3 suites   0 💤
    3 files     0 ❌
   
   Results for commit 4fcdffe6.
   
   
[test-results]:data:application/gzip;base64,H4sIAGgpa2oC/12Myw7CIBQFf6Vh7YICBerPGLxwE2JbDI9V479Lq/bh7sycZGaCfnCJXBt+aUgqPm9gSzTZh6mirFiPvFyC/uCWCsCfefhnNbtA44eTcDGG+DWxTFtx2afgR+y9lQ+5lY81COPocwUiECyik1p2oLjqWsapZZbru8WegmNG6laJnrzesHDl3/8AAAA=
   




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

    Worklog Id:     (was: 1033005)
    Time Spent: 20m  (was: 10m)

> RFC 8693 token exchange (handleTokenExchange) unreachable for 
> x-www-form-urlencoded POSTs
> -----------------------------------------------------------------------------------------
>
>                 Key: KNOX-3399
>                 URL: https://issues.apache.org/jira/browse/KNOX-3399
>             Project: Apache Knox
>          Issue Type: Bug
>          Components: Server
>    Affects Versions: 3.0.0
>            Reporter: Sandor Molnar
>            Assignee: Sandor Molnar
>            Priority: Major
>             Fix For: 3.0.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> {{JWTFederationFilter.doFilter}} reads {{grant_type}} via {{getParameter}} on 
> the wrapped request. Form-encoded requests are wrapped in 
> {{UrlEncodedFormRequest}}, whose {{getParameter}} returns query-string values 
> only and ignores the body (by design). So for a standard RFC 8693 POST (grant 
> + tokens in the body), {{grant_type}} reads back {{null}}, the 
> {{handleTokenExchange}} branch is skipped, and the request falls through to 
> the single-token path - which validates only {{subject_token}} and silently 
> ignores {{actor_token}}.
> *Impact:* the two-token OBO flow never runs over the normal content type. A 
> POST with *no* {{actor_token}} still returns 200:
> {code}
> $ curl -k -X POST 
> "https://localhost:8443/gateway/tokenexchange/knoxtoken/api/v2/token"; -H 
> "Content-Type: application/x-www-form-urlencoded" -d 
> "grant_type=urn:ietf:params:oauth:grant-type:token-exchange&subject_token=$SUBJECT_TOKEN"
> {"access_token":"eyJqa3UiOi...","token_id":"e313ffbc-b27e-468e-a684-192b8939ca87","managed":"true","endpoint_public_cert":"MIIDZDE...ETTA="
> {code}
> *Evidence (remote debugger, on v3.0.0 branch):* 
> {{httpRequest.getParameter("grant_type") → null}} whereas 
> {{ServletRequestUtils.unwrapHttpServletRequest(request).getParameter("grant_type")
>  → the expected URN}}.
> *Fix direction:* in {{doFilter}}, read {{grant_type}} from the unwrapped 
> request (guard on absent Authorization header so proxied bodies aren't 
> consumed); read subject_token/actor_token from the unwrapped request in 
> {{handleTokenExchange}}; keep passing the wrapped request downstream. Add a 
> regression test in {{OAuthFlowsFederationFilterTest}} posting grant + both 
> tokens in the body (wrapped in {{UrlEncodedFormRequest}}).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to