mirror of
https://github.com/elder-plinius/OBLITERATUS.git
synced 2026-12-06 11:04:06 +01:00
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:
2 files changed
+6
No files matched your search
@@ -125,6 +125,9 @@ def test_evidence_parent_must_be_private_and_cannot_be_a_symlink(tmp_path):
|
|||||||
)
|
)
|
||||||
public = tmp_path / "public"
|
public = tmp_path / "public"
|
||||||
public.mkdir(mode=0o755)
|
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"):
|
with pytest.raises(ContractError, match="private"):
|
||||||
write_evidence(public / "evidence.json", evidence)
|
write_evidence(public / "evidence.json", evidence)
|
||||||
private = tmp_path / "private"
|
private = tmp_path / "private"
|
||||||
|
|||||||
@@ -343,6 +343,9 @@ def test_private_load_evidence_refuses_unsafe_destination(tmp_path, unsafe_sink)
|
|||||||
directory = tmp_path / "evidence"
|
directory = tmp_path / "evidence"
|
||||||
if unsafe_sink == "world_readable":
|
if unsafe_sink == "world_readable":
|
||||||
directory.mkdir(mode=0o755)
|
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:
|
else:
|
||||||
target = tmp_path / "target"
|
target = tmp_path / "target"
|
||||||
target.mkdir(mode=0o700)
|
target.mkdir(mode=0o700)
|
||||||
|
|||||||
Reference in new issue
Block a user