@@ -208,6 +208,10 @@ def test_client_config_rejects_empty_or_invalid_base_url():
208208
209209 with pytest .raises (HyperbrowserError , match = "must not include query parameters" ):
210210 ClientConfig (api_key = "test-key" , base_url = "https://example.local#frag" )
211+ with pytest .raises (
212+ HyperbrowserError , match = "base_url must not include user credentials"
213+ ):
214+ ClientConfig (api_key = "test-key" , base_url = "https://user:pass@example.local" )
211215
212216 with pytest .raises (
213217 HyperbrowserError , match = "base_url must not contain newline characters"
@@ -360,6 +364,10 @@ def test_client_config_normalize_base_url_validates_and_normalizes():
360364 HyperbrowserError , match = "base_url must not contain control characters"
361365 ):
362366 ClientConfig .normalize_base_url ("https://example.local\x00 api" )
367+ with pytest .raises (
368+ HyperbrowserError , match = "base_url must not include user credentials"
369+ ):
370+ ClientConfig .normalize_base_url ("https://user:pass@example.local" )
363371 with pytest .raises (
364372 HyperbrowserError , match = "base_url path must not contain relative path segments"
365373 ):
@@ -372,3 +380,15 @@ def test_client_config_normalize_base_url_validates_and_normalizes():
372380 HyperbrowserError , match = "base_url must not contain whitespace characters"
373381 ):
374382 ClientConfig .normalize_base_url ("https://example.local/%2520api" )
383+ with pytest .raises (
384+ HyperbrowserError , match = "base_url host must not contain backslashes"
385+ ):
386+ ClientConfig .normalize_base_url ("https://example.local%255C" )
387+ with pytest .raises (
388+ HyperbrowserError , match = "base_url host must not contain whitespace characters"
389+ ):
390+ ClientConfig .normalize_base_url ("https://example.local%2520" )
391+ with pytest .raises (
392+ HyperbrowserError , match = "base_url host must not contain control characters"
393+ ):
394+ ClientConfig .normalize_base_url ("https://example.local%2500" )
0 commit comments