Add pkce_code_challenge_methods option #1735
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This fixes #1717, allowing a user to prevent using the
plain
method for PKCE code challenges, since usingplain
is deemed insecure (as noted in the PKCE RFC)This is based off of #1732, I also have some local changes that pull in irb and debug gems for interactive debugging, which I found helpful when testing in the console via:
Other Information
In
validate_pkce_code_challenge_methods
I did want to log an error if the database hadn't been configured for PKCE, however, due to how this code is instantiated, I wasn't able to get that working due to the model class not yet being loaded bybin/console
(so I'm assuming issues may happen in actual usage too).The error message does list the supported methods always as
plain or S256
— to fix that, we'd need to parameterize the localisation message to receive the supported code challenge methods. I wasn't sure if I should make such a change here.This also limits us to only ever supporting plain or S256, but to my knowledge no other PKCE code challenge methods exist, and doorkeeper wouldn't have support for them anyway due to how it hardcodes which ones it supports.