Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL parsing check and documentation #17

Merged
merged 2 commits into from
Oct 9, 2024
Merged

URL parsing check and documentation #17

merged 2 commits into from
Oct 9, 2024

Conversation

frenzymadness
Copy link
Member

Raise warning for unstable URL parsing

urllib.parse does not perform any input validation so
its output might be invalid as well. Because host_whitelist
functionality relies on hostnames parsed from URLs, the result of
urlsplit is newly compared with the result of simple regex
parser and If they differ, a warning is raised.

@frenzymadness
Copy link
Member Author

The first round of feedback is addressed in the fixup commit. The URLs that cause the warning to be raised are not allowed anymore.

tests/test_clean.py Outdated Show resolved Hide resolved
@frenzymadness
Copy link
Member Author

The last two fixup commits contain:

  • improved condition with more trust for the new parser
  • fixed typing
  • improved test

@hroncok could you please eyeball it before I merge it and release it?

`urllib.parse` does not perform any input validation so
its output might be invalid as well. Because host_whitelist
functionality relies on hostnames parsed from URLs, the result of
`urlsplit` is newly compared with the result of simple regex
parser and If they differ, a warning is raised.
@frenzymadness frenzymadness merged commit 8b3c612 into main Oct 9, 2024
9 checks passed
@frenzymadness frenzymadness deleted the url_parsing branch October 9, 2024 10:21
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.

2 participants