-
Notifications
You must be signed in to change notification settings - Fork 45.1k
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
Validate URLs in web commands before execution #2616
Validate URLs in web commands before execution #2616
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've also tested this PR and it's works for me.
local_prefixes = [ | ||
"file:///", | ||
"file://localhost/", | ||
"file://localhost", | ||
"http://localhost", | ||
"http://localhost/", | ||
"https://localhost", | ||
"https://localhost/", | ||
"http://2130706433", | ||
"http://2130706433/", | ||
"https://2130706433", | ||
"https://2130706433/", | ||
"http://127.0.0.1/", | ||
"http://127.0.0.1", | ||
"https://127.0.0.1/", | ||
"https://127.0.0.1", | ||
"https://0.0.0.0/", | ||
"https://0.0.0.0", | ||
"http://0.0.0.0/", | ||
"http://0.0.0.0", | ||
"http://0000", | ||
"http://0000/", | ||
"https://0000", | ||
"https://0000/", | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a separate PR may want to drop everything that has a scheme that's not in [http
, https
, ws
, git
].
See the list here https://en.wikipedia.org/wiki/List_of_URI_schemes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree with that
This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request. |
ed95b82
to
b84a561
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #2616 +/- ##
==========================================
- Coverage 49.40% 41.64% -7.76%
==========================================
Files 63 64 +1
Lines 3004 3021 +17
Branches 494 505 +11
==========================================
- Hits 1484 1258 -226
- Misses 1400 1698 +298
+ Partials 120 65 -55
... and 13 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly. |
This will probably fix a lot of browsing issues, as the chrome driver will exit with really ugly errors even if the URL doesn't contain a schema. |
Background
This pr targets #1887 to validate urls before browsing. It was implemented in web_requests get_response but not for selenium or git.
Changes
Adds a validator for urls that just builds off of the validation that existed in get_response and adds it as a wrapper to add to commands that have a url as the first param.
Documentation
Documented in code
Test Plan
Still passes test suite and tested locally
PR Quality Checklist