Repository navigation
fix(verifier): keep image PATH tool dirs on images without python3 and on rust images - #1195
Open
shubham2345 wants to merge 1 commit into
Open
shubham2345 wants to merge 1 commit into
shubham2345 wants to merge 1 commit into
Conversation
…d on rust images (benchflow-ai#1174) Validate trusted PATH entries with sh+stat when the python3 probe fails, instead of silently dropping every image tool directory (cargo, mvnd). Official rust:* images ship /usr/local/cargo/bin, its parent and the binaries inside at mode 777, which the root-owned/not-writable rule rejected. Remove group/world write from such root-owned directories, their ancestors and the files inside before verification, and keep them when nothing inside is owned by another user. Log directories that stay untrusted at warning level. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1174.
Problem
The verifier rebuilds its PATH from the image PATH, keeping only root-owned, non-group/world-writable directories. Two things made Rust and Java tasks score 0 with
cargo: command not found/mvnd: command not found:python3 -c .... On images without python3 it failed, logged at debug level, and every image tool directory was dropped.rust:*images ship/usr/local/cargo/bin, its parent and the binaries inside at mode 777, so the rule rejected cargo even when Python was present.Change
sh+statand apply the same rule.Verification
tests/test_sandbox_hardening.py: 107 pass (7 new); ruff clean.crustbench-leftpad(rust:1.83-slim): 0 -> 1.0.google__gson-2311(mvnd 755, no python3): 0 on main (mvnd: command not found) -> 1.0. Run on a scratch copy of the task with the#!/bin/bashline moved to line 1, see below._trusted_verifier_path: stock rust 777 trusted and hardened to 755; 777 dir with a world-writable root file trusted; 777 dir with an agent-owned file refused; 755 dir untouched; dir under the agent home refused; non-root-owned dir refused.Not covered
tests/test.shhas a comment above#!/bin/bash, so it runs undershand fails onset -o pipefailbefore reachingmvnd.🤖 Generated with Claude Code