Python
Network profile "open" on every sandbox provider; the default on Windows
Rohit C Prasad8e2952597023
diff --git a/coworker/sandbox/network_profiles.py b/coworker/sandbox/network_profiles.pyindex 520ab16b..0c5f6405 100644--- a/coworker/sandbox/network_profiles.py+++ b/coworker/sandbox/network_profiles.py@@ -1,10 +1,15 @@"""Where an agent's commands may connect, in OUR words. Every provider renders these listsinto its own mechanism: OpenShell into `network_policies`, Seatbelt into the allow-list-proxy. HTTPS (port 443) only.+proxy, Windows into the account it runs as. HTTPS (port 443) only.++`open` is the profile with no list at all: files stay isolated, the network is the+machine's own (ruling of 2026-09-25). It is the default on Windows for now."""from __future__ import annotations+import sys+CODE_HOSTS = ["github.com", "api.github.com", "codeload.github.com", "objects.githubusercontent.com", "raw.githubusercontent.com", "gitlab.com"]PACKAGE_REGISTRIES = ["pypi.org", "files.pythonhosted.org", "registry.npmjs.org", "crates.io", "static.crates.io", "index.crates.io", "proxy.golang.org", "sum.golang.org"]SEARCH_APIS = ["api.search.brave.com", "api.tavily.com", "html.duckduckgo.com", "duckduckgo.com"]@@ -15,10 +20,22 @@ PROFILES: dict[str, dict[str, list[str]]] = {"strict": {"code-hosts": CODE_HOSTS, "package-registries": PACKAGE_REGISTRIES},# plus the search APIs."standard": {"code-hosts": CODE_HOSTS, "package-registries": PACKAGE_REGISTRIES, "search-apis": SEARCH_APIS},+ # any host: no proxy, no list. Files are still confined.+ "open": {},}+OPEN = "open"DEFAULT_PROFILE = "strict"+def default_profile(platform: str = sys.platform) -> str:+ """The profile a machine uses until it chooses one: `open` on Windows, `strict` elsewhere."""+ return OPEN if platform == "win32" else DEFAULT_PROFILE+++def is_open(profile: str) -> bool:+ return check(profile) == OPEN++def check(profile: str) -> str:if profile not in PROFILES:raise ValueError(f"unknown network profile {profile!r} (known: {', '.join(sorted(PROFILES))})")diff --git a/coworker/sandbox/providers/openshell.py b/coworker/sandbox/providers/openshell.pyindex b3b3f45a..d189a57d 100644--- a/coworker/sandbox/providers/openshell.py+++ b/coworker/sandbox/providers/openshell.py@@ -121,7 +121,7 @@ class OpenShellProvider:return {"provider": self.name,"enforcement": "full",- "reason": f"OpenShell {PINNED_VERSION}: Landlock and seccomp on every process, network profile '{self.profile}', no keys inside",+ "reason": f"OpenShell {PINNED_VERSION}: Landlock and seccomp on every process, network {'open (any host)' if self.profile == 'open' else 'profile ' + repr(self.profile)}, no keys inside","sandbox": self.sandbox_name,"image": self.image,"credentials": self.copied.describe() if self.copied is not None else [],diff --git a/coworker/sandbox/providers/openshell_policy.py b/coworker/sandbox/providers/openshell_policy.pyindex 8b6ac5cd..d4f91e3f 100644--- a/coworker/sandbox/providers/openshell_policy.py+++ b/coworker/sandbox/providers/openshell_policy.py@@ -47,6 +47,10 @@ PROFILES: dict[str, dict[str, dict[str, Any]]] = {profile: {_POLICY_KEYS[name]: _hosts(name, hosts) for name, hosts in groups.items()}for profile, groups in network_profiles.PROFILES.items()}+# The `open` profile: any host, any port. NOT yet proved against a running gateway (the+# Linux VM was stopped when it was written, 2026-09-25); if OpenShell refuses the wildcard+# the sandbox fails to start, which is the safe way round.+PROFILES[network_profiles.OPEN] = {"open": {"name": "open", "endpoints": [{"host": "*", "port": 0}], "binaries": [dict(b) for b in _ANY_BINARY]}}DEFAULT_PROFILE = network_profiles.DEFAULT_PROFILEdiff --git a/coworker/sandbox/providers/seatbelt.py b/coworker/sandbox/providers/seatbelt.pyindex ba84d2b8..15ff9bed 100644--- a/coworker/sandbox/providers/seatbelt.py+++ b/coworker/sandbox/providers/seatbelt.py@@ -110,7 +110,12 @@ class SeatbeltProvider:self._proxy: Optional[netproxy.AllowListProxy] = Nonedef describe(self) -> dict[str, Any]:- network = f"only the hosts of the '{self.profile}' profile, through the allow-list proxy" if self.network else "none"+ if not self.network:+ network = "none"+ elif network_profiles.is_open(self.profile):+ network = "open (any host; the files are still confined)"+ else:+ network = f"only the hosts of the '{self.profile}' profile, through the allow-list proxy"return {"provider": self.name,"sandbox": self.sandbox,@@ -127,6 +132,7 @@ class SeatbeltProvider:runtime_dir=self._dir,read_only=[str(self._runner), *read_paths(), str(toolchain.bin_dir())],proxy_port=self._proxy.port if self._proxy is not None else None,+ open_network=self.network and network_profiles.is_open(self.profile),)def _environment(self) -> dict[str, str]:@@ -151,12 +157,12 @@ class SeatbeltProvider:def _create(self) -> None:preflight()os.makedirs(os.path.join(self._dir, "tmp", "cache"), exist_ok=True)- if self.network:+ if self.network and not network_profiles.is_open(self.profile):hosts = sorted({h for g in self.grants for h in g.hosts})# A session with grants gets its own proxy, because its allow list is its own.self._proxy = netproxy.AllowListProxy(self.profile, extra_hosts=hosts) if hosts else netproxy.shared(self.profile)else:- self._proxy = None+ self._proxy = None # `open`: the profile lets everything out, nothing to routeself.copied = creds.copy_in(self.grants,self._dir,diff --git a/coworker/sandbox/providers/seatbelt_profile.py b/coworker/sandbox/providers/seatbelt_profile.pyindex 8f945e06..6af75cee 100644--- a/coworker/sandbox/providers/seatbelt_profile.py+++ b/coworker/sandbox/providers/seatbelt_profile.py@@ -112,10 +112,12 @@ def render(read_only: Sequence[str] = (),proxy_port: Optional[int] = None,home: Optional[str] = None,+ open_network: bool = False,) -> str:"""`roots`: [{"path": absolute path, "writable": bool}]. `runtime_dir`: this sandbox'sown folder (socket and temporary files). `read_only`: more paths to read, e.g. the- runner file and the Python that runs it."""+ runner file and the Python that runs it. `open_network`: the `open` profile, any host+ and any local port, no proxy; the files stay confined."""writable = [real(r["path"]) for r in roots if r.get("writable")]readable = [real(r["path"]) for r in roots if not r.get("writable")]readable += [real(p) for p in read_only] + home_read_only(home)@@ -148,7 +150,9 @@ def render(f"(allow network-bind network-inbound network-outbound (local unix-socket (subpath {_quote(runtime)})))",f"(allow network-bind network-inbound network-outbound (remote unix-socket (subpath {_quote(runtime)})))",]- if proxy_port:+ if open_network:+ lines += ["; the network: open (the 'open' profile); the files above are still the wall", "(allow network*)"]+ elif proxy_port:lines += ["; the network: only the allow-list proxy on this machine",f'(allow network-outbound (remote tcp "localhost:{int(proxy_port)}"))',diff --git a/coworker/sandbox/settings.py b/coworker/sandbox/settings.pyindex a211bb37..c46f3563 100644--- a/coworker/sandbox/settings.py+++ b/coworker/sandbox/settings.py@@ -69,7 +69,7 @@ def snapshot(cfg: Optional[app_config.Config] = None) -> dict[str, Any]:"effective_provider": effective,"refused": refused,"providers": providers,- "network_profile": (cfg.sandbox_network_profile or network_profiles.DEFAULT_PROFILE),+ "network_profile": (cfg.sandbox_network_profile or network_profiles.default_profile()),"network_profiles": [{"name": name, "hosts": network_profiles.hosts(name)} for name in network_profiles.PROFILES],diff --git a/coworker/sandbox/workspace.py b/coworker/sandbox/workspace.pyindex 1e071029..ad602ef0 100644--- a/coworker/sandbox/workspace.py+++ b/coworker/sandbox/workspace.py@@ -227,9 +227,9 @@ def open_workspace(from .credentials import grantedgrants = granted(credentials)- from .network_profiles import DEFAULT_PROFILE, check+ from .network_profiles import check, default_profile- profile = check((network_profile or "").strip().lower() or DEFAULT_PROFILE)+ profile = check((network_profile or "").strip().lower() or default_profile())if name == SEATBELT:from .providers.seatbelt import SeatbeltProviderfrom .registry import SandboxRegistrydiff --git a/docs/config.example.toml b/docs/config.example.tomlindex 15ae0301..056e89ac 100644--- a/docs/config.example.toml+++ b/docs/config.example.toml@@ -36,8 +36,9 @@ port = 8765# the default), "openshell" (one NVIDIA OpenShell container per agent) or "seatbelt"# (the sandbox built into macOS). See docs/openshell.md and docs/macos-sandbox.md.# sandbox_provider = "openshell"-# Network allow list inside a sandbox: "strict" (code hosts and package registries) or-# "standard" (plus the search APIs).+# Network allow list inside a sandbox: "strict" (code hosts and package registries),+# "standard" (plus the search APIs) or "open" (any host; the files are still confined).+# The default is "strict", or "open" on Windows.# sandbox_network_profile = "strict"# Credentials an agent may be given, copied into the sandbox for the session and deleted# with it. All off unless enabled here or in Settings ▸ Sandbox.diff --git a/docs/macos-sandbox.md b/docs/macos-sandbox.mdindex a0a2fcfb..51e5eae1 100644--- a/docs/macos-sandbox.md+++ b/docs/macos-sandbox.md@@ -31,7 +31,7 @@ Settings ▸ Sandbox ▸ "macOS sandbox", or in `config.toml`:```tomlsandbox_provider = "seatbelt" # or "direct": commands run in the OpenWorker process-sandbox_network_profile = "strict" # or "standard"+sandbox_network_profile = "strict" # or "standard", or "open" (any host; files still confined)```The setting is per machine; a project's own config cannot change it.@@ -59,11 +59,12 @@ follow the proxy variables; a program that ignores them has no network at all.## The network allow list-Two profiles, shared with the OpenShell sandbox:+Three profiles, shared with the OpenShell and Windows sandboxes:- **strict** (default): GitHub, GitLab, and the package registries — PyPI, npm, crates.io,the Go proxy.- **standard**: strict plus the search APIs (Brave, Tavily, DuckDuckGo).+- **open**: any host, no proxy. The files are still the wall.Credentials shared on purpose (below) add the hosts their tools need.diff --git a/docs/openshell.md b/docs/openshell.mdindex 5f0241f4..6f6a2dcc 100644--- a/docs/openshell.md+++ b/docs/openshell.md@@ -78,7 +78,7 @@ The setting is per machine, in Settings ▸ Sandbox or in `config.toml`:```tomlsandbox_provider = "openshell" # or "direct": commands run in the OpenWorker process-sandbox_network_profile = "strict" # or "standard"+sandbox_network_profile = "strict" # or "standard", or "open" (any host; files still confined)```A project's own config cannot change it. When a machine is set to OpenShell and OpenShell@@ -108,6 +108,7 @@ Two profiles:- **strict** (default): GitHub, GitLab, and the package registries — PyPI, npm, crates.io,the Go proxy.- **standard**: strict plus the search APIs (Brave, Tavily, DuckDuckGo).+- **open**: any host, no allow list. The files are still the wall.OpenShell enforces the list in the container. Credentials shared on purpose (nextsection) add the hosts their tools need.diff --git a/surfaces/gui/src/components/SettingsView.tsx b/surfaces/gui/src/components/SettingsView.tsxindex f6f17652..a594385d 100644--- a/surfaces/gui/src/components/SettingsView.tsx+++ b/surfaces/gui/src/components/SettingsView.tsx@@ -846,7 +846,9 @@ function SandboxSection({ machine }: { machine?: Machine | null }) {</span><span className="block text-meta text-muted">{c.does ? c.does : shipped(c.name, "does")}{" "}- {c.hosts && c.hosts.length ? <span className="text-faint">{t("settingsx.sandbox.also_allows", { hosts: c.hosts.join(", ") })}</span> : null}+ {c.hosts && c.hosts.length && cfg.network_profile !== "open" ? (+ <span className="text-faint">{t("settingsx.sandbox.also_allows", { hosts: c.hosts.join(", ") })}</span>+ ) : null}</span></span><span className="text-meta text-muted shrink-0 whitespace-nowrap">diff --git a/surfaces/gui/src/locales/en.json b/surfaces/gui/src/locales/en.jsonindex 472edb76..302384ce 100644--- a/surfaces/gui/src/locales/en.json+++ b/surfaces/gui/src/locales/en.json@@ -2289,6 +2289,8 @@"profile_strict_desc": "GitHub, GitLab and the package registries (PyPI, npm, crates, Go).","profile_standard": "Standard","profile_standard_desc": "Strict plus the search APIs.",+ "profile_open": "Open",+ "profile_open_desc": "Any host. Files stay isolated. The default on Windows.","network_help": "Shared credentials below add the hosts their tools need.","credentials": "Credentials an agent may be given","add": "Add a file or folder…",diff --git a/surfaces/gui/src/locales/zh.json b/surfaces/gui/src/locales/zh.jsonindex bb972e86..c1d758ce 100644--- a/surfaces/gui/src/locales/zh.json+++ b/surfaces/gui/src/locales/zh.json@@ -2249,6 +2249,8 @@"profile_strict_desc": "GitHub、GitLab 和软件包源(PyPI、npm、crates、Go)。","profile_standard": "标准","profile_standard_desc": "严格模式加上搜索 API。",+ "profile_open": "开放",+ "profile_open_desc": "任意主机。文件仍然隔离。Windows 上的默认值。","network_help": "下方共享的凭据会加入其工具所需的主机。","credentials": "可提供给同事的凭据","add": "添加文件或文件夹…",diff --git a/tests/test_sandbox_openshell.py b/tests/test_sandbox_openshell.pyindex 5a42573b..68fe0b22 100644--- a/tests/test_sandbox_openshell.py+++ b/tests/test_sandbox_openshell.py@@ -48,6 +48,8 @@ def test_network_profiles():assert {"github.com", "pypi.org", "registry.npmjs.org"} <= hosts(strict)assert "api.tavily.com" not in hosts(strict) and "api.tavily.com" in hosts(standard)assert all(entry["binaries"] for entry in strict.values()) # OpenShell requires the field+ opened = policy.render(ROOTS, profile="open")["network_policies"]+ assert [e["host"] for e in opened["open"]["endpoints"]] == ["*"] # any host; unproved against a gatewaywith pytest.raises(ValueError):policy.render(ROOTS, profile="wide-open")diff --git a/tests/test_sandbox_seatbelt.py b/tests/test_sandbox_seatbelt.pyindex 25112b71..7d0e1271 100644--- a/tests/test_sandbox_seatbelt.py+++ b/tests/test_sandbox_seatbelt.py@@ -157,6 +157,15 @@ def test_every_profile_has_hosts_and_an_unknown_one_is_refused():netproxy.AllowListProxy("wide-open")+def test_the_open_profile_has_no_list_and_is_the_default_on_windows_only(tmp_path):+ assert network_profiles.hosts("open") == [] and network_profiles.is_open("open")+ assert network_profiles.default_profile("win32") == "open"+ assert network_profiles.default_profile("darwin") == "strict" and network_profiles.default_profile("linux") == "strict"+ # Seatbelt: the files stay confined, the network clause opens+ text = seatbelt_profile.render([{"path": str(tmp_path), "writable": True}], runtime_dir=str(tmp_path), open_network=True, home=str(tmp_path))+ assert "(allow network*)" in text and "localhost:" not in text and "(deny default)" in text++# -- selection ------------------------------------------------------------------------def test_an_explicit_seatbelt_setting_refuses_when_it_cannot_be_used(monkeypatch):def broken() -> None:diff --git a/tests/test_sandbox_settings.py b/tests/test_sandbox_settings.pyindex a05939cd..c11b3655 100644--- a/tests/test_sandbox_settings.py+++ b/tests/test_sandbox_settings.py@@ -25,7 +25,10 @@ def test_snapshot_reports_the_default_rule_and_the_shipped_entries(config_file):native = "windows" if sys.platform == "win32" else "seatbelt" # the operating system's own sandboxassert [p["name"] for p in snap["providers"]] == ["direct", native, "openshell"]assert next(p for p in snap["providers"] if p["name"] == "direct")["usable"]- assert snap["network_profile"] == "strict" and [n["name"] for n in snap["network_profiles"]] == ["strict", "standard"]+ from coworker.sandbox import network_profiles++ assert snap["network_profile"] == network_profiles.default_profile() # strict; `open` on Windows+ assert [n["name"] for n in snap["network_profiles"]] == ["strict", "standard", "open"]assert [(e["name"], e["enabled"]) for e in snap["credentials"]] == [("ssh", False), ("gh", False), ("aws", False), ("kube", False)]assert snap["config_path"] == str(config_file)