Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wellknown is missing code_challenge_methods_supported #2311

Closed
gbolo opened this issue Jan 18, 2021 · 12 comments
Closed

wellknown is missing code_challenge_methods_supported #2311

gbolo opened this issue Jan 18, 2021 · 12 comments
Labels
feat New feature or request. help wanted We are looking for help on this one.
Milestone

Comments

@gbolo
Copy link
Contributor

gbolo commented Jan 18, 2021

Describe the bug

when pkce is enabled, i would expect the wellknown to advertise it's supported methods as defined in RFC 8414

   code_challenge_methods_supported
      OPTIONAL.  JSON array containing a list of Proof Key for Code
      Exchange (PKCE) [RFC7636] code challenge methods supported by this
      authorization server.  Code challenge method values are used in
      the "code_challenge_method" parameter defined in Section 4.3 of
      [RFC7636].  The valid code challenge method values are those
      registered in the IANA "PKCE Code Challenge Methods" registry
      [IANA.OAuth.Parameters].  If omitted, the authorization server
      does not support PKCE.

The final sentence states: If omitted, the authorization server does not support PKCE.

Expected behavior

I expect to see the following snippet in the wellknown response:

...
"code_challenge_methods_supported": [
  "plain",
  "S256"
],
...
@aeneasr
Copy link
Member

aeneasr commented Jan 21, 2021

Hey there, yes, https://tools.ietf.org/html/rfc8414#section-2 is actually not supported ATM, we only support OpenID Connect Discovery. Would you be up for some PRs to address this?

@aeneasr aeneasr added the feat New feature or request. label Jan 21, 2021
@aeneasr aeneasr added this to the unplanned milestone Jan 21, 2021
@aeneasr aeneasr added the help wanted We are looking for help on this one. label Jan 21, 2021
@gbolo
Copy link
Contributor Author

gbolo commented Jan 22, 2021

Hi @aeneasr, if this is something you would like to support I certainly don't mind addressing it in a PR. Whats the scope here? I'm assuming its to simply add the supported methods to the wellknown response when pkce is enabled on hydra. Is that correct? I will familiarize myself with the code base

@aeneasr
Copy link
Member

aeneasr commented Jan 26, 2021

@gbolo sorry for the late reply. Yes, that is correct, and also add a little test (probably 3-5 lines). If you need guidance I can point you to the files!

@gbolo
Copy link
Contributor Author

gbolo commented May 12, 2021

hi @aeneasr

I looked through the code. It's fairly simple to modify the wellknown response to include the supported methods. However, I could not find any indication in the code that pkce is actually being validated. Adding support for pkce is a bit more than I bargained for ;) Can you verify this?

@aeneasr
Copy link
Member

aeneasr commented May 17, 2021

PKCE is supported and somewhat documented.

@gbolo
Copy link
Contributor Author

gbolo commented May 26, 2021

hi @aeneasr it looks like pkce is supported from the client perspective, but I cannot find any server side verification being done. Can you confirm this?

@aeneasr
Copy link
Member

aeneasr commented May 27, 2021

Confirm what exactly?

@gbolo
Copy link
Contributor Author

gbolo commented May 27, 2021

Confirm what exactly?

@aeneasr that the hydra server will validate the code_verifier with the already received code_challenge and the code_challenge_method during the client's access token request (PKCE)

@aeneasr
Copy link
Member

aeneasr commented May 27, 2021

That's what I tried to say #2311 (comment)

What was not clear about it / what could be improved?

@gbolo
Copy link
Contributor Author

gbolo commented May 27, 2021

Hi @aeneasr sorry if I'm not being clear enough. I already made the required changes to the wellknown response, however i cannot find any evidence of the hydra server keeping track of the code challenge for validation later on when the token request comes in. Can you point me to the code that does this validation? It would be difficult for me to write that validation code, as I would have to get more intimate with the code base. I hope its clear now.

@aeneasr
Copy link
Member

aeneasr commented May 27, 2021

Ory Hydra supports PKCE as required by the specification and does the validation and everything. This happens in the library we are using: https://github.com/ory/fosite/

@gbolo
Copy link
Contributor Author

gbolo commented May 27, 2021

thanks @aeneasr

I have modified the response and adjusted the testcase for the response. Please review #2547 when you get a chance.

@aeneasr aeneasr closed this as completed in 9693168 Jun 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request. help wanted We are looking for help on this one.
Projects
None yet
Development

No branches or pull requests

2 participants