Skip to content

Commit cfb6877

Browse files
authored
test(contract): keep the mode-000 read checks POSIX-only (#6007)
1 parent 22197ed commit cfb6877

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

‎tests/control_plane/test_agent_preferences.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ def dispatch():
248248
@pytest.mark.parametrize("denied_target", ["journal", "namespace"])
249249
def test_permission_denied_hook_is_not_empty_and_recovers(tmp_path, denied_target):
250250
import os
251-
if os.geteuid() == 0:
252-
pytest.skip("root bypasses POSIX read permission")
251+
if os.name == "nt" or os.geteuid() == 0:
252+
pytest.skip("mode 000 read denial needs a non-root POSIX host")
253253
_, runtime, registry = _write_fixture(tmp_path, required_capability="network")
254254
scope = ("--goal-id", GOAL_ID, "--agent-id", AGENT_ID)
255255
rc, written = _run_cli(registry, runtime, "semantic-preference", "agent", "remember", *scope,

‎tests/test_contract_scan_unreadable_files.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ def fail_git_probe(_: Path) -> dict[str, object]:
6767
assert payload["scanned_files"] == 1
6868

6969

70-
@pytest.mark.skipif(os.geteuid() == 0, reason="root reads mode 000 files")
70+
@pytest.mark.skipif(
71+
os.name == "nt" or os.geteuid() == 0,
72+
reason="mode 000 read denial needs a non-root POSIX host",
73+
)
7174
def test_scan_public_boundary_reports_unreadable_file(tmp_path: Path) -> None:
7275
(tmp_path / "ok.md").write_text("hello\n", encoding="utf-8")
7376
locked = tmp_path / "locked.md"

0 commit comments

Comments
 (0)