10000 Allow missing client to trigger invalid client error when force_pkce is enabled by gkemmey · Pull Request #1762 · doorkeeper-gem/doorkeeper · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Allow missing client to trigger invalid client error when force_pkce is enabled #1762

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ User-visible changes worth mentioning.
Add your entry here.
- [#1755] Fix the error message for force_pkce
- [#1761] Memoize authentication failure
- [#1762] Allow missing client to trigger invalid client error when force_pkce is enabled

## 5.8.1

Expand Down
6 changes: 1 addition & 5 deletions lib/doorkeeper/oauth/authorization_code_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,11 @@ def pkce_supported?
Doorkeeper.config.access_grant_model.pkce_supported?
end

def confidential?
client&.confidential
end

def validate_params
@missing_param =
if grant&.uses_pkce? && code_verifier.blank?
:code_verifier
elsif !confidential? && Doorkeeper.config.force_pkce? && code_verifier.blank?
elsif client && !client.confidential && Doorkeeper.config.force_pkce? && code_verifier.blank?
:code_verifier
elsif redirect_uri.blank?
:redirect_uri
Expand Down
8 changes: 8 additions & 0 deletions spec/lib/oauth/authorization_code_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,14 @@
end.not_to change { client.reload.access_tokens.count }
end
end

context "when the app is missing" do
it "does not assume non-confidential and forcibly validate pkce params" do
request = described_class.new(server, grant, nil, params)
request.validate
expect(request.error).to eq(Doorkeeper::Errors::InvalidClient)
end
end
end

context "when PKCE is supported" do
Expand Down
0