diff --git a/ouroboros/tools/registry.py b/ouroboros/tools/registry.py index 17822a11..dc3e9399 100644 --- a/ouroboros/tools/registry.py +++ b/ouroboros/tools/registry.py @@ -964,8 +964,7 @@ class ToolRegistry: resolved = pathlib.Path(candidate).resolve(strict=False) except Exception: continue - if any(resolved.is_relative_to(allowed_root) for allowed_root in allowed_data_roots): - continue + if any(resolved.is_relative_to(allowed_root) for allowed_root in allowed_data_roots): continue for protected_path in protected_paths: try: resolved.relative_to(protected_path) @@ -979,6 +978,7 @@ class ToolRegistry: if not pro_workspace_passthrough: return "⚠️ WORKSPACE_SHELL_BLOCKED: write-like shell commands may not target absolute paths outside the active workspace." continue + if any(path_text_is_inside(candidate, root) for root in allowed_data_roots): continue for protected_path in protected_paths: if path_text_is_inside(candidate, protected_path): return "⚠️ WORKSPACE_SHELL_BLOCKED: write-like shell command mentions Ouroboros system/data paths." diff --git a/tests/test_headless_cli.py b/tests/test_headless_cli.py index 6354e1c8..7b671844 100644 --- a/tests/test_headless_cli.py +++ b/tests/test_headless_cli.py @@ -769,7 +769,7 @@ def test_workspace_shell_keeps_symlinked_workspace_absolute_paths_allowed(tmp_pa registry.set_context(ctx) target = workspace_link / "inside.txt" - result = registry.execute("run_command", {"cmd": f"touch {target}"}) + result = registry.execute("run_command", {"cmd": [sys.executable, "-c", f"open({str(target)!r}, 'w').write('ok')"]}) assert "WORKSPACE_SHELL_BLOCKED" not in result, result assert (real_workspace / "inside.txt").exists()