Add bounded stdin to owner execution
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 2s

Assistant: codex
Assistant-Model: gpt-5.6-sol
Assistant-Session: 01a06def-6490-7033-8448-2eab2d12ed44
This commit is contained in:
tegwick 2026-09-04 22:30:11 +02:00
parent fd9297810c
commit b6655d8859
15 changed files with 74 additions and 17 deletions

View file

@ -49,13 +49,14 @@ def main() -> int:
created.raise_for_status()
sandbox_id = created.json()["sandbox_id"]
code = (
"import json, os; from pathlib import Path; "
"import json, os, sys; from pathlib import Path; task=sys.stdin.read(); "
f"outside=Path({str(outside)!r}).exists(); "
"interfaces=[line.split(':',1)[0].strip() for line in "
"Path('/proc/net/dev').read_text().splitlines()[2:]]; "
"print(json.dumps({'cwd':str(Path.cwd()), 'copied':Path('copied.txt').is_file(), "
"'host_source_visible':outside, 'network_interfaces':interfaces, "
"'run_id':os.environ.get('SANDBOXER_RUN_ID')}))"
"'run_id':os.environ.get('SANDBOXER_RUN_ID'), "
"'stdin_bytes':len(task.encode())}))"
)
executed = client.post(
f"/v1/sandboxes/{sandbox_id}/exec",
@ -63,6 +64,7 @@ def main() -> int:
json={
"command": ["/usr/bin/python3", "-c", code],
"consumer": consumer,
"stdin_text": '{"title":"non-secret API smoke"}',
"timeout_seconds": 30,
"max_output_bytes": 65_536,
},
@ -95,6 +97,8 @@ def main() -> int:
and proof["copied"]
and not proof["host_source_visible"]
and proof["network_interfaces"] == ["lo"]
and proof["stdin_bytes"] == 32
and "stdin_text" not in result
and payload["teardown"]["workspace_removed"]
)
return 0 if passed else 1