fix(browser): apply private-page guard to browser_cdp frame_id routing - #57464
Closed
srojk34 wants to merge 1 commit into
Closed
fix(browser): apply private-page guard to browser_cdp frame_id routing#57464srojk34 wants to merge 1 commit into
srojk34 wants to merge 1 commit into
Conversation
browser_cdp's frame_id (OOPIF) path returned early via _browser_cdp_via_supervisor before _browser_cdp_private_guard ever ran, unlike the stateless path a few lines below. A model that navigated a cloud browser to a private/internal URL could still read page content by passing frame_id, bypassing the same SSRF/private-page boundary already enforced on Runtime.evaluate, Page.navigate, and other raw CDP calls. Apply the same guard call used by the stateless path before dispatching to the supervisor, so both routing modes share one boundary.
Contributor
|
suggesting changes Security evidence:
Please make the Signed: GPT-5.5-xhigh in Codex |
Contributor
|
Merged via PR #57660 — your commit was cherry-picked onto current main with your authorship preserved in git log (rebase-merge). Thanks for the fix! |
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_cdp'sframe_id(OOPIF) routing path returns early via_browser_cdp_via_supervisor(...)before_browser_cdp_private_guard(...)ever runs. The stateless path (noframe_id) a few lines below correctly calls the guard before dispatching. This means a cloud browser that has navigated to a private/internal URL can still have its content read viabrowser_cdp(method="Runtime.evaluate", ..., frame_id="..."), even though the identical call withoutframe_idis correctly blocked.This is the same private-page/SSRF boundary that
browser_snapshot,browser_console,browser_eval, and the statelessbrowser_cdppath already enforce (see the guard series in_browser_cdp_private_guard's own docstring: "raw CDP calls ... must not become the sibling bypass for the guarded browser tools").Fix
Call the same
_browser_cdp_private_guard(...)used by the stateless path before dispatching to_browser_cdp_via_supervisor(...), so both routing modes share one boundary. No other behavior changes.Test plan
test_frame_id_route_blocked_when_current_page_is_private— confirms aframe_idcall is blocked (and the supervisor is never reached) when the current page is private, mirroring the existing stateless-path test.test_frame_id_route_allowed_when_page_is_not_private— sanity check that ordinaryframe_idrouting still works when the page isn't private.uv run --frozen --extra dev python -m pytest tests/tools/test_browser_cdp_tool.py -x -q— 25 passed.uv run --frozen --extra dev python -m pytest tests/tools/ -k browser -q— 514 passed, 23 skipped (unrelated), no regressions.ruff checkon both changed files — clean.