Skip to content

Commit 10fff05

Browse files
committed
revert disallowing query params in redirect_uri
1 parent f2142e1 commit 10fff05

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ User-visible changes worth mentioning.
77

88
## main
99

10-
- [#PR ID] Add your PR description here.
10+
- [#1535] Revert changes introduced in #1528 to allow query params in `redirect_uri` as per the spec.
1111

1212
## 5.5.3
1313

lib/doorkeeper/oauth/helpers/uri_checker.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@ def self.matches?(url, client_url)
1919
url = as_uri(url)
2020
client_url = as_uri(client_url)
2121

22-
unless client_url.query.nil? && url.query.nil?
22+
unless client_url.query.nil?
2323
return false unless query_matches?(url.query, client_url.query)
2424

2525
# Clear out queries so rest of URI can be tested. This allows query
2626
# params to be in the request but order not mattering.
2727
client_url.query = nil
28-
url.query = nil
2928
end
3029

3130
# RFC8252, Paragraph 7.3
@@ -35,6 +34,7 @@ def self.matches?(url, client_url)
3534
client_url.port = nil
3635
end
3736

37+
url.query = nil
3838
url == client_url
3939
end
4040

spec/lib/oauth/authorization_code_request_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@
139139
context "when redirect_uri contains some query params" do
140140
let(:redirect_uri) { "#{client.redirect_uri}?query=q" }
141141

142-
it "responds with invalid_grant" do
142+
it "allows query params" do
143143
request.validate
144-
expect(request.error).to eq(:invalid_grant)
144+
expect(request.error).to eq(nil)
145145
end
146146
end
147147

spec/lib/oauth/helpers/uri_checker_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ module Doorkeeper::OAuth::Helpers
7272
expect(described_class).to be_matches(uri, client_uri)
7373
end
7474

75-
it "doesn't allow additional query parameters" do
75+
it "allows additional query parameters" do
7676
uri = "http://app.co/?query=hello"
7777
client_uri = "http://app.co"
78-
expect(described_class).not_to be_matches(uri, client_uri)
78+
expect(described_class).to be_matches(uri, client_uri)
7979
end
8080

8181
it "doesn't allow non-matching domains through" do

0 commit comments

Comments
 (0)