Conversation
7a152f1 to
7d0cb81
Compare
|
Hourly commander review note: the new CDP guard passes the focused suite locally, but I found one small bypass worth fixing before marking the PR ready.
from tools.browser_cdp_tool import _runtime_source_reads_sensitive_state
assert _runtime_source_reads_sensitive_state('document.cookie') is True
assert _runtime_source_reads_sensitive_state('document?.cookie') is True # currently FalseLocal verification from a detached worktree at
Suggested fix: include optional chaining in the |
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary\n\nVerdict: LGTM\n\nSecurity fix that blocks sensitive browser state reads (cookies, localStorage, sessionStorage) from entering model context via CDP. Well-scoped with comprehensive test coverage (160 lines of tests covering method blocking, expression pattern detection, and obfuscation normalization).\n\n- Clean allowlist/blocklist approach for CDP methods\n- Regex patterns correctly handle JS string concatenation and unicode escapes\n- Moved validation before CDP dispatch (correct order of operations)\n- Updated usage docs to reflect the new blocking behavior\n- Test parametrization covers edge cases well\n\n---\nReviewed by Hermes Agent
Related: this competes with #46899 for hardening the |
|
Hourly commander follow-up on the latest head Local focused checks in a detached worktree:
The current pattern is still |
tonydwb
left a comment
There was a problem hiding this comment.
Security hardening (275 additions). Blocks CDP methods that expose cookies, localStorage, sessionStorage, and IndexedDB. Includes JS obfuscation normalization (string concatenation, unicode escapes) to prevent bypass. Comprehensive test coverage with parametrized tests.
Reviewed by Hermes Agent
|
Fixed the optional-chaining cookie-read bypass in c2cbfdc. The Runtime source scanner now catches document?.cookie / spaced optional chaining / document?.["cookie"], with regression coverage for Runtime.evaluate and Runtime.callFunctionOn. Verified locally:
|
|
Hourly commander follow-up on head Local focused checks in a detached worktree:
New issue: the PR blocks explicit That means a model can bypass the new |
|
Fixed the Runtime.evaluate / Runtime.callFunctionOn IndexedDB + CacheStorage bypass in What changed:
Verified locally:
|
|
Hourly commander follow-up on head Local focused checks in a detached worktree:
Previously reported Runtime storage cases now pass the scanner ( Because |
|
Fixed the remaining template-literal sensitive-state bypass in Why this was worth fixing:
What changed:
Verification:
|
|
Thanks for the focused pre-dispatch guard and the follow-up fixes from the review thread. The underlying issue is present on current main: Problems
Suggested changes
Automated hermes-sweeper review. |
Summary
Blocks raw browser credential/storage reads from the
browser_cdpescape hatch before any Chrome DevTools Protocol request is dispatched.This closes the highest-risk CDP surfaces that can dump authenticated browser state directly into model/tool context:
Network.getAllCookies/Network.getCookiesStorage.getCookiesRuntime.evaluate/Runtime.callFunctionOnsource that readsdocument.cookie,localStorage, orsessionStorageAllowed non-read storage methods still pass through, so the tool remains useful for browser automation and low-level debugging.
Why
browser_cdpis intentionally a low-level escape hatch. That makes it useful, but it also bypasses the safer high-level browser tool surfaces. Cookie and Web Storage reads can expose session tokens or other browser secrets and then persist those values in transcripts. This PR blocks those calls before WebSocket dispatch, so the sensitive values never enter model context.Notes
document['co' + 'okie'].Network.getAllCookiesas an example and documents the blocked surfaces.Tests
python -m compileall -q tools/browser_cdp_tool.py tests/tools/test_browser_cdp_tool.pypython -m pytest tests/tools/test_browser_cdp_tool.py -q -o 'addopts='python -m ruff check tools/browser_cdp_tool.py tests/tools/test_browser_cdp_tool.py