Skip to content

reject unparseable authority when host/port/password checks are set - #165

Open
Bountybette wants to merge 1 commit into
python-hyper:mainfrom
Bountybette:validator-invalid-authority
Open

Bountybette wants to merge 1 commit into
python-hyper:mainfrom
Bountybette:validator-invalid-authority

Conversation

@Bountybette

Copy link
Copy Markdown

When the authority can't be parsed, uri.host, uri.port and uri.userinfo all return None, and Validator.validate treats None as "component absent", so Validator().allow_hosts("good.com").validate(uri_reference("https://user@user@evil.com/")) passes even though urllib.parse.urlsplit and requests send that URL to evil.com (the same gap skips allow_ports and forbid_use_of_password). validate now raises InvalidComponentsError for an unparseable authority whenever one of those checks is configured, so validators that only check the scheme or path behave exactly as before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant