Confine browser_upload_file sources to granted session roots#190
Open
yoshibase wants to merge 1 commit into
Open
Confine browser_upload_file sources to granted session roots#190yoshibase wants to merge 1 commit into
yoshibase wants to merge 1 commit into
Conversation
browser_upload_file resolved a caller-supplied path and uploaded it with no session-root check. The tool is kind=write → EXTERNAL risk, and Mode.AUTO returns full access with no path scoping — so a model-controlled path could exfiltrate ~/.config/coworker/secrets.json (or an SSH key) through a page file input. Thread the session roots into make_browser_automation_tools (same seam the email tools and the open browser_screenshot fix use) and require the upload source to resolve under a granted root before Playwright opens. Any granted root is fine — this is a read/exfil boundary, not a write. Relative paths resolve against the primary root. Hermetic tests assert the refusal paths without Playwright: absolute escape, ../ traversal, no-roots, and that a path inside a read-only granted root still passes confinement.
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
Fixes #189.
browser_upload_fileresolved a caller-supplied path and uploaded it with no session-rootcheck. The tool is registry kind
write→RiskClass.EXTERNAL, andMode.AUTOreturns"full access"with no path scoping — so a model-controlled path could exfiltrate~/.config/coworker/secrets.json(or an SSH key) through a page file input.This is the source sibling of #45 (which confines
browser_screenshot's destination).Outgoing email attachments already confine; upload did not.
What changed
make_browser_automation_tools(roots=…)— same seam email tools (and Confine browser_screenshot destination to the session's writable roots #45) useroot (any granted root is fine — this is a read/exfil boundary, not a write)
"no granted session directory…"/"…is outside the session's granted directories"make_integration_toolsforwardsrootsinto the browser factoryTest plan
Hermetic — confinement runs before the browser opens, so no Playwright needed:
New cases:
../traversal escape → rejectedNo new dependencies. Complementary to #45 (screenshot); the
roots=parameter is additiveand defaults to
None, so the two PRs compose cleanly either merge order.