fix(browser): guard Camofox eval private pages (salvage #56764) - #712
Merged
Conversation
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
Camofox eval can no longer read private/internal pages via
browser_console(expression=...)— it now goes through the same SSRF guard the other browser backends already enforce.Root cause:
_browser_eval()returned_camofox_eval(...)at the very top, before the private-network guard block, so Camofox mode skipped both the private-URL literal pre-scan (fetch('http://127.0.0.1/secret')) and the post-eval page-URL recheck (navigate-then-read the DOM). This closes the eval sibling of the browser hardening in NousResearch#56173, NousResearch#56526, NousResearch#56664.Salvage of NousResearch#56764 by @rayjun (rayoo) — cherry-picked to preserve authorship, with small maintainer follow-ups folded in (see Follow-ups).
Changes
tools/browser_tool.py:_camofox_current_page_private_url()— a Camofox analogue of_current_page_private_url()that probeswindow.location.hrefvia the/evaluateendpoint._camofox_eval(), after eval, withhold the result when the page is now private/internal (same_eval_ssrf_guard_activegating and error envelope as the non-Camofox path).tests/tools/test_browser_eval_ssrf.py:TestCamofoxEvalGuard— regression coverage for (a) private-URL literal blocked before any Camofox request fires, and (b) private current-page blocked without leaking the eval result.Follow-ups (maintainer, on top of the salvage)
task_idinto_camofox_eval(not the_last_session_key-resolved key) so it matches every other Camofox tool — Camofox keeps its own raw-task_id-keyed session map; the resolved agent-browser key could mint a foreign tab after a mid-process backend switch./eval→/evaluatedocstring; add the fail-open rationale to the new probe's docstring to keep parity with the sibling.Validation
fetch('http://127.0.0.1/…')via evalTrust model: the guard is only active for non-local backends (
_eval_ssrf_guard_active), unchanged for local/sidecar/allow_private_urlssessions. Soundness is at parity with the non-Camofox guard it mirrors (same navigate-then-read TOCTOU characteristics; the literal pre-scan covers the primary direct-fetch vector).Closes NousResearch#56764.
Mirror-of: NousResearch#56874
NousResearch#56874