fix(eval): trial log dirs are world-writable - #67
Conversation
Native-eval start chmod'd agent, verifier, and artifact log dirs to 0o777, so another user on the same host could plant or rewrite trial logs. Create those dirs as 0o755 instead. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. Reviewed September 5, 2026, 11:59 AM ET / 15:59 UTC. ClawSweeper reviewWhat this changesThe PR changes three native-evaluation log directories from world-writable to owner-writable permissions and adds a helper-level regression test. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 4 items remain This hardening remains necessary on current main, but the unchanged branch has not resolved the prior compatibility finding or provided production-path proof. Priority: P2 Review scores
Verification
How this fits togetherShellBench’s native evaluation runner starts Docker task environments and runs agents and verifiers inside them. Host directories mounted into those containers collect logs, artifacts, and rewards used to evaluate the run. flowchart TD
A[Task definition and container user] --> D[Docker task container]
B[Host trial directory] --> C[Directory permissions]
C --> D
D --> E[Agent and verifier writes]
E --> F[Logs artifacts and rewards]
Before merge
Findings
Agent review detailsSecurityNone. Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Restrict unrelated host users while preserving writes by the host runner and configured container identity, with fresh-run and existing-task compatibility demonstrated. Do we have a high-confidence way to reproduce the issue? Yes, from source: on Linux, host-owned 0755 bind mounts deny writes by a different non-root container UID, while agent and verifier commands require those writes. No runtime reproduction was executed in this read-only review. Is this the best way to solve the issue? No. The permission change addresses world-writable directories but omits the container writer’s identity; the existing archive-cleanup permissions do not establish compatibility for active log mounts. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: not found in the target repository. Codex review notes: model internal, reasoning high; reviewed against c1a79f731541. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
What does this PR do?
Trial directories created for native eval are no longer world-writable (
0o777). They are created as0o755so only the owner can write logs and artifacts.Why?
DockerTaskEnvironment.startchmod'dagent,verifier, andartifacts/logs/artifactsto0o777. On a shared host another user could plant or rewrite trial logs. Cleanup paths in the same tree already use0o755for directories.Changes
prepare_trial_dirs()and chmod0o755instead of0o777test_prepare_trial_dirs_are_owner_writable_onlyTests
tests/test_native_eval_runner.py::test_prepare_trial_dirs_are_owner_writable_onlypasses locallypython -m ruff check clawbench app.py scripts testspasses locallyRed: with
0o777the new check reports mode511(0o777) instead of493(0o755). Green: dirs are0o755.What Problem This Solves
Fixes an issue where native-eval trial log directories were world-writable, so another user on the same host could plant or rewrite agent, verifier, or artifact logs.
Evidence
Terminal output from the patched helper:
Real behavior proof
Behavior or issue addressed: Native-eval start created trial dirs with mode
0o777, which lets any local user write logs.Real environment tested: macOS 15, Python 3.14, worktree
/tmp/sb-chmodonfix/trial-dir-mode.Exact steps or command run after this patch:
Evidence after fix: terminal output from the patched helper. Trial dirs are owner-writable only:
Observed result after fix:
prepare_trial_dirscreatesagent,verifier, andartifacts/logs/artifactsas0o755.What was not tested: A live docker compose trial against a remote registry.