Skip to content
Python

OPE-111: browser URL tools are egress, not reads

Devika Verma80ba13d35919
diff --git a/coworker/connectors/tool_defs.py b/coworker/connectors/tool_defs.py
index e9ef6e02..88b7735a 100644
--- a/coworker/connectors/tool_defs.py
+++ b/coworker/connectors/tool_defs.py
@@ -27,9 +27,11 @@ class ConnectorToolDef:
TOOL_DEFS: tuple[ConnectorToolDef, ...] = (
ConnectorToolDef(
"browser",
+ # web_fetch by another name: the URL is model-chosen, so this gates as egress —
+ # a "read" kind here would bypass the web_fetch gate entirely (OPE-111).
"browser_read_url",
"Read public URL",
- "read",
+ "write",
"Fetch readable text from a public URL.",
),
ConnectorToolDef(
diff --git a/coworker/risk.py b/coworker/risk.py
index 46938976..26faeac0 100644
--- a/coworker/risk.py
+++ b/coworker/risk.py
@@ -30,7 +30,10 @@ SHELL_TOOL = "run_shell"
# URL's path/query can carry data outbound, so it is NOT a pure read — it must reach the
# gate. `web_search` reaches a FIXED destination (the configured provider), but its query
# is model-chosen free text — the same outbound channel — so it gates too (spec §2.2).
-EGRESS_TOOLS = {"web_fetch", "web_search"}
+# The browser connector's URL tools are the same channel by another name (OPE-111):
+# classifying them here gives them the full egress treatment (domain allowlist, host-named
+# cards) instead of a bare approval gate.
+EGRESS_TOOLS = {"web_fetch", "web_search", "browser_read_url", "browser_open_url"}
_BASE: dict[str, RiskClass] = {
**{name: RiskClass.WRITE_LOCAL for name in WRITE_TOOLS},
diff --git a/tests/test_egress_and_overrides.py b/tests/test_egress_and_overrides.py
index 1d5567c6..04828715 100644
--- a/tests/test_egress_and_overrides.py
+++ b/tests/test_egress_and_overrides.py
@@ -127,10 +127,12 @@ def test_override_may_tighten(tmp_path):
_CATALOG_WRITES_IN_DISGUISE = (
"github_clone", # writes a repo tree to disk
"github_pull", # mutates a working tree
- "browser_open_url", # model-chosen URL = egress, like web_fetch
"browser_screenshot", # writes an image file, creating parent dirs
"browser_upload_file", # sends a local file's contents off-machine
)
+# Model-chosen URLs: web_fetch by another name, so they take the full egress path
+# (domain allowlist, host-named cards), not the bare approval gate.
+_CATALOG_EGRESS_IN_DISGUISE = ("browser_read_url", "browser_open_url")
def test_disguised_catalog_writes_gate():
@@ -139,6 +141,9 @@ def test_disguised_catalog_writes_gate():
for name in _CATALOG_WRITES_IN_DISGUISE:
assert approval_for_tool(name) is True, name
assert classify(name) is RiskClass.EXTERNAL, name
+ for name in _CATALOG_EGRESS_IN_DISGUISE:
+ assert approval_for_tool(name) is True, name
+ assert classify(name) is RiskClass.EGRESS, name
def test_catalog_floor_holds_even_with_lying_metadata():
@@ -162,7 +167,7 @@ def test_override_cannot_relax_a_catalog_write(tmp_path):
def test_catalog_reads_stay_relaxed_and_unprompted(tmp_path):
from coworker.connectors.tool_defs import approval_for_tool
- for name in ("browser_read_url", "email_search", "github_get_issue"):
+ for name in ("browser_snapshot", "email_search", "github_get_issue"):
assert approval_for_tool(name) is False, name
assert classify(name) is RiskClass.READ, name
# And the plugin-relaxation path is untouched for genuine reads.
@@ -176,7 +181,7 @@ def test_disguised_writes_blocked_in_read_only_modes(tmp_path):
meta = SimpleNamespace(requires_approval=True)
for mode in (Mode.DISCUSS, Mode.PLAN):
eng = PermissionEngine(workspace_root=tmp_path, mode=mode)
- for name in _CATALOG_WRITES_IN_DISGUISE:
+ for name in _CATALOG_WRITES_IN_DISGUISE + _CATALOG_EGRESS_IN_DISGUISE:
d = eng.evaluate(name, {}, meta)
assert not d.allowed, f"{name} ran in {mode.value} mode"
diff --git a/tests/test_send_target_resolution.py b/tests/test_send_target_resolution.py
index 6498b006..449d8a99 100644
--- a/tests/test_send_target_resolution.py
+++ b/tests/test_send_target_resolution.py
@@ -30,8 +30,9 @@ def test_integration_tools_reads_are_free_writes_gate(tmp_path):
tools["github_list_commits"].__aisuite_tool_metadata__.requires_approval
is False
)
+ # OPE-111: a model-chosen URL fetch is egress, not a read — it gates like web_fetch.
assert (
- tools["browser_read_url"].__aisuite_tool_metadata__.requires_approval is False
+ tools["browser_read_url"].__aisuite_tool_metadata__.requires_approval is True
)
assert (
tools["github_create_issue"].__aisuite_tool_metadata__.requires_approval is True