Skip to content

Commit 4bccafa

Browse files
authored
Allow more characters in redirect URI paths (#4975)
2 parents b71a770 + d49ff70 commit 4bccafa

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

policies/client_registration/client_registration.rego

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ allow if {
1818

1919
parse_uri(url) := obj if {
2020
is_string(url)
21-
url_regex := `^(?P<scheme>[a-z][a-z0-9+.-]*):(?://(?P<host>((?:(?:[a-z0-9]|[a-z0-9][a-z0-9-]*[a-z0-9])\.)*(?:[a-z0-9]|[a-z0-9][a-z0-9-]*[a-z0-9])|127.0.0.1|0.0.0.0|\[::1\])(?::(?P<port>[0-9]+))?))?(?P<path>/[A-Za-z0-9/.-]*)?(?P<query>\?[-a-zA-Z0-9()@:%_+.~#?&/=]*)?$`
21+
url_regex := `^(?P<scheme>[a-z][a-z0-9+.-]*):(?://(?P<host>((?:(?:[a-z0-9]|[a-z0-9][a-z0-9-]*[a-z0-9])\.)*(?:[a-z0-9]|[a-z0-9][a-z0-9-]*[a-z0-9])|127.0.0.1|0.0.0.0|\[::1\])(?::(?P<port>[0-9]+))?))?(?P<path>/[A-Za-z0-9/._~-]*)?(?P<query>\?[-a-zA-Z0-9()@:%_+.~#?&/=]*)?$`
2222
[matches] := regex.find_all_string_submatch_n(url_regex, url, 1)
2323
obj := {"scheme": matches[1], "authority": matches[2], "host": matches[3], "port": matches[4], "path": matches[5], "query": matches[6]}
2424
}

policies/client_registration/client_registration_test.rego

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ test_web_redirect_uri if {
217217
client_registration.allow with input.client_metadata as {
218218
"application_type": "web",
219219
"client_uri": "https://example.com/",
220-
"redirect_uris": ["https://example.com/second/callback", "https://example.com/callback", "https://example.com/callback?query=value"],
220+
"redirect_uris": ["https://example.com/second/callback", "https://example.com/callback", "https://example.com/callback?query=value", "https://example.com/callback~path_with_extra_chars"],
221221
}
222222

223223
client_registration.allow with input.client_metadata as {

0 commit comments

Comments
 (0)