File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ def validate_registered_redirect_uri(url: AnyUrl) -> None:
6565 if url .scheme == "http" and url .host not in ("localhost" , "127.0.0.1" , "[::1]" ):
6666 raise InvalidRedirectUriError (f"redirect_uri must use https for non-loopback hosts; got { str (url )!r} " )
6767 # RFC 7591 §2: redirect_uri MUST NOT contain a fragment component.
68- if url .fragment :
68+ if url .fragment is not None :
6969 raise InvalidRedirectUriError (f"redirect_uri must not have a fragment; got { str (url )!r} " )
7070
7171
Original file line number Diff line number Diff line change @@ -102,3 +102,8 @@ def test_validate_registered_redirect_uri_http_127_prefix_domain_rejected():
102102def test_validate_registered_redirect_uri_fragment_rejected ():
103103 with pytest .raises (InvalidRedirectUriError , match = "must not have a fragment" ):
104104 validate_registered_redirect_uri (AnyUrl ("https://example.com/cb#frag" ))
105+
106+
107+ def test_validate_registered_redirect_uri_empty_fragment_rejected ():
108+ with pytest .raises (InvalidRedirectUriError , match = "must not have a fragment" ):
109+ validate_registered_redirect_uri (AnyUrl ("https://example.com/cb#" ))
You can’t perform that action at this time.
0 commit comments