fix(security): validate URL scheme and block SSRF in browser_navigate - #2695
Closed
dieutx wants to merge 2 commits into
Closed
fix(security): validate URL scheme and block SSRF in browser_navigate#2695dieutx wants to merge 2 commits into
dieutx wants to merge 2 commits into
Conversation
browser_navigate passes URLs directly to the browser subprocess with no scheme validation. file://, javascript:, and data: URLs can be used to read local files or execute code in the browser context. Private network addresses (localhost, metadata endpoints) are also reachable. Restrict to http/https schemes and add SSRF check via url_safety before the browser command is dispatched.
Move url_safety import to module level as _is_browser_url_safe so tests can mock it. Update test_browser_navigate_returns_policy_block to bypass SSRF check so the website policy path is tested correctly.
Contributor
Author
|
Closing — this was addressed in #3058 which is already merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
browser_navigate()passes URLs directly to the browser subprocess with no scheme validationfile://,javascript:,data:URLs can be used to read local files or execute code in the browser contexturl_safety.is_safe_url()moduleSecurity Impact
file:///etc/shadoworfile:///root/.hermes/.envcould read local files via browser renderingjavascript:could execute code in the browser contexthttp://169.254.169.254/could reach cloud metadata endpointsHow to reproduce
Before fix, these URLs pass without any validation:
How to test
Platform tested