Sandor Molnar created KNOX-3602:
-----------------------------------

             Summary: Read OAuth client_credentials grant parameters from the 
request body only
                 Key: KNOX-3602
                 URL: https://issues.apache.org/jira/browse/KNOX-3602
             Project: Apache Knox
          Issue Type: Improvement
          Components: JWT
    Affects Versions: 3.0.0
            Reporter: Sandor Molnar



RFC 6749 sends token request parameters in the request body: the client makes a 
POST with {{application/x-www-form-urlencoded}} parameters (section 4.4.2), and 
client credentials must not be put in the request URI (section 2.3.1).

{{JWTFederationFilter}} reads the OAuth parameters with 
{{ServletRequest.getParameter()}}, which returns query string parameters as 
well as form body parameters. As a result, Knox also accepts a 
{{client_credentials}} request whose {{grant_type}} is in the URL rather than 
in the body, e.g. a POST to {{.../token?grant_type=client_credentials}} with 
HTTP Basic client credentials.

Knox should only treat a request as a {{client_credentials}} grant when 
{{grant_type}} comes from the form body, and reject a {{client_credentials}} 
request that carries {{grant_type}} in the query string with a clear error.

While there, the existing check that rejects {{client_secret}} in the query 
string should look at decoded parameter names rather than a substring match on 
the raw query string, so that it catches every encoding of the name and does 
not match unrelated names that merely end in {{client_secret}}.

Compatibility: sending {{grant_type}} in the query string with HTTP Basic 
client credentials has worked since KNOX-3260 / KNOX-3312 (3.0.0). Clients that 
do this will have to move {{grant_type}} into the body. To be decided: reject 
outright in the next release, or log a deprecation WARN first and reject in the 
release after.




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

Reply via email to