fix(exec): tighten Seatbelt filesystem and launcher boundaries
Keep temporary work inside the granted workspace instead of exposing host scratch trees, enforce read-only roots, and pin the system sandbox launcher before PATH lookup. Preserve documented network access and the narrow system paths needed by shell and Git. Add native macOS containment and launcher regressions plus shared backend contract coverage. Document scratch and custom-tool requirements without changing existing bwrap or Windows behavior.
This commit is contained in:
1 parent
947ed17e8b
commit
8b9e35bf78
8 files changed
+241
-55
No files matched your search
@@ -373,7 +373,8 @@ def test_exec_still_blocks_real_outside_path_via_redirect(tmp_path):
|
||||
assert "path outside working dir" in blocked
|
||||
|
||||
|
||||
def test_exec_allows_absolute_path_inside_bwrap_ro_bind(tmp_path, monkeypatch):
|
||||
@pytest.mark.parametrize("backend", ["bwrap", "seatbelt"])
|
||||
def test_exec_allows_absolute_path_inside_sandbox_ro_bind(tmp_path, monkeypatch, backend):
|
||||
workspace = tmp_path / "workspace"
|
||||
workspace.mkdir()
|
||||
tool_bin = tmp_path / "home" / ".local" / "bin"
|
||||
@@ -384,7 +385,7 @@ def test_exec_allows_absolute_path_inside_bwrap_ro_bind(tmp_path, monkeypatch):
|
||||
tool = ExecTool(
|
||||
working_dir=str(workspace),
|
||||
restrict_to_workspace=True,
|
||||
sandbox="bwrap",
|
||||
sandbox=backend,
|
||||
sandbox_ro_binds=[str(tool_bin)],
|
||||
)
|
||||
|
||||
@@ -398,7 +399,8 @@ def test_exec_allows_absolute_path_inside_bwrap_ro_bind(tmp_path, monkeypatch):
|
||||
assert blocked is None
|
||||
|
||||
|
||||
def test_exec_allows_absolute_path_inside_bwrap_rw_bind(tmp_path, monkeypatch):
|
||||
@pytest.mark.parametrize("backend", ["bwrap", "seatbelt"])
|
||||
def test_exec_allows_absolute_path_inside_sandbox_rw_bind(tmp_path, monkeypatch, backend):
|
||||
workspace = tmp_path / "workspace"
|
||||
workspace.mkdir()
|
||||
cache_dir = tmp_path / "cache"
|
||||
@@ -407,7 +409,7 @@ def test_exec_allows_absolute_path_inside_bwrap_rw_bind(tmp_path, monkeypatch):
|
||||
tool = ExecTool(
|
||||
working_dir=str(workspace),
|
||||
restrict_to_workspace=True,
|
||||
sandbox="bwrap",
|
||||
sandbox=backend,
|
||||
sandbox_rw_binds=[str(cache_dir)],
|
||||
)
|
||||
|
||||
@@ -421,7 +423,7 @@ def test_exec_allows_absolute_path_inside_bwrap_rw_bind(tmp_path, monkeypatch):
|
||||
assert blocked is None
|
||||
|
||||
|
||||
def test_exec_bind_roots_do_not_widen_guard_without_bwrap(tmp_path):
|
||||
def test_exec_bind_roots_do_not_widen_guard_without_sandbox(tmp_path):
|
||||
workspace = tmp_path / "workspace"
|
||||
workspace.mkdir()
|
||||
tool_bin = tmp_path / "home" / ".local" / "bin"
|
||||
@@ -446,7 +448,8 @@ def test_exec_bind_roots_do_not_widen_guard_without_bwrap(tmp_path):
|
||||
assert "path outside working dir" in blocked
|
||||
|
||||
|
||||
def test_exec_bwrap_bind_parent_does_not_widen_workspace_guard(tmp_path, monkeypatch):
|
||||
@pytest.mark.parametrize("backend", ["bwrap", "seatbelt"])
|
||||
def test_exec_sandbox_bind_parent_does_not_widen_workspace_guard(tmp_path, monkeypatch, backend):
|
||||
workspace = tmp_path / "workspace"
|
||||
workspace.mkdir()
|
||||
secret = tmp_path / "config.json"
|
||||
@@ -455,7 +458,7 @@ def test_exec_bwrap_bind_parent_does_not_widen_workspace_guard(tmp_path, monkeyp
|
||||
tool = ExecTool(
|
||||
working_dir=str(workspace),
|
||||
restrict_to_workspace=True,
|
||||
sandbox="bwrap",
|
||||
sandbox=backend,
|
||||
sandbox_ro_binds=[str(tmp_path)],
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user