Merge pull request #416 from elder-plinius/test/private-evidence-fixture-modes

test: set explicit permissions for unsafe evidence fixtures
This commit is contained in:
Joseph Magly authored and GitHub committed 2026-10-29 10:18:02 -04:00
commit 309c2cdb30
2 files changed
+6

No files matched your search

+3
View File
@@ -125,6 +125,9 @@ def test_evidence_parent_must_be_private_and_cannot_be_a_symlink(tmp_path):
)
public = tmp_path / "public"
public.mkdir(mode=0o755)
# mkdir's mode is filtered by the caller's umask; this fixture must be public.
public.chmod(0o755)
assert public.stat().st_mode & 0o777 == 0o755
with pytest.raises(ContractError, match="private"):
write_evidence(public / "evidence.json", evidence)
private = tmp_path / "private"
@@ -343,6 +343,9 @@ def test_private_load_evidence_refuses_unsafe_destination(tmp_path, unsafe_sink)
directory = tmp_path / "evidence"
if unsafe_sink == "world_readable":
directory.mkdir(mode=0o755)
# Exercise the unsafe mode even when the test runner uses umask 077.
directory.chmod(0o755)
assert directory.stat().st_mode & 0o777 == 0o755
else:
target = tmp_path / "target"
target.mkdir(mode=0o700)