Skip to content

Commit d49ff70

Browse files
committed
Don't mistakenly invoke a regex range expression
1 parent cf9d705 commit d49ff70

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
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
}

0 commit comments

Comments
 (0)