test: check sandbox file readability across platforms

This commit is contained in:
RuochenPan
2026-09-09 09:18:33 +08:00
parent eb4fd7ee12
commit 2995920a90
+7 -1
View File
@@ -51,7 +51,13 @@ async def test_managed_shell_output_cannot_be_redirected_outside_sandbox(
from pathlib import Path
secret = Path({str(secret)!r})
assert not secret.exists(), "The host file must be outside the sandbox."
# Seatbelt allows metadata queries while denying access to file contents.
try:
secret.read_bytes()
except (FileNotFoundError, PermissionError):
pass
else:
raise AssertionError("The host file must not be readable inside the sandbox.")
for log in Path({str(shared_temp)!r}).rglob("sh_*.log"):
log.unlink()
log.symlink_to(secret)