fix(browser): migrate snapshot/vision private-URL checks onto shared helper - #482
Open
hashbender wants to merge 1 commit into
Open
fix(browser): migrate snapshot/vision private-URL checks onto shared helper#482hashbender wants to merge 1 commit into
hashbender wants to merge 1 commit into
Conversation
|
Review Complete Risk: 🟠 High (72/100) — no findings · 102 LOC across 2 files The _is_always_blocked_url SSRF floor is conditionally gated in browser_snapshot and browser_vision, creating a bypass on cloud VMs with local Chromium backends. Files Reviewed (2 files) |
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.
Closes NousResearch#56579
Problem
browser_snapshotandbrowser_visionused a weaker SSRF floor than the shared_current_page_private_urlhelper. Their inline checks only tested:This misses the
_is_always_blocked_url()predicate, which covers cloud-metadata addresses (169.254.169.254,169.254.169.253,100.100.100.200,metadata.google.internal). If_is_safe_urlwere to returnTruefor one of those addresses, the guard would silently pass and expose private page content via snapshot or vision.The shared
_current_page_private_urlhelper — already used correctly bybrowser_back,browser_console, andbrowser_get_images— applies both predicates:Fix
Add
_is_always_blocked_url(_current_url)to the condition in both inline guards so they match the shared helper:Two lines changed in
browser_tool.py.Tests
Added
TestSnapshotBlocksCloudMetadataViaAlwaysBlockedandTestVisionBlocksCloudMetadataViaAlwaysBlockedintests/tools/test_browser_snapshot_ssrf.py. Each test patches_is_safe_urlto returnTrue(simulating the gap) while_is_always_blocked_urlcorrectly identifies169.254.169.254— and asserts both functions still block the request.Mirror-of: NousResearch#56583
NousResearch#56583