Skip to content

fix(review): normalise an absolute in-workspace symlink target before the '..' check (#1157) - #1207

Merged
bingran-you merged 1 commit into
benchflow-ai:mainfrom
Benjamin-eecs:fix/evidence-absolute-link-normpath
Oct 29, 2026
Merged

bingran-you merged 1 commit into
benchflow-ai:mainfrom
Benjamin-eecs:fix/evidence-absolute-link-normpath

Conversation

@Benjamin-eecs

Copy link
Copy Markdown
Contributor

Fixes #1157.

Problem. review.evidence._link_target checked an absolute symlink target after stripping the workspace prefix but before normalising it. A link the agent made as /root/analysis/scripts/../figures resolves inside the workspace, yet _relative_path rejected its .. part and the whole capture failed with EvidenceError: Unsafe evidence path: 'analysis/scripts/../figures', so a verified rollout was never reviewed. Relative targets were already normalised first.

Change

  • src/benchflow/review/evidence.py: normalise the absolute target after relative_to(workspace) (posixpath.normpath). A result that is .. or starts with ../ raises "Evidence symlink escapes workspace", as an absolute target outside the workspace already does; anything else is checked and returned relative to the link's parent, as before.
  • tests/test_review_evidence.py: a unit table for _link_target (in-workspace .. kept, . kept, plain absolute unchanged, two escapes refused), an end-to-end capture of an absolute in-workspace .. link through capture_workspace, prepare_workspace_upload and install_uploaded_workspace, and a negative control for a link that climbs out after normalising.
  • CHANGELOG.md: a Fixed entry.

Validation

  • Against main's code the new tests fail (6 of 8, all with Unsafe evidence path); with the fix all pass.
  • tests/test_review_evidence.py, test_review_evidence_runtime.py, test_acceptance_evidence.py: 137 passed. Full suite with an empty HOME: 6599 passed, 4 failed; the same 4 fail on main's code here (no uv on the test PATH, no playwright browser, two host-specific fixtures). ruff check and ruff format --check clean.
  • FrontierPhysics-Infra has run the same normalisation as a local patch (3111e65, bench patch 43) on 0.7.8 since 2026-10-10.

Not in this PR: release/0.8's kept_link (PR #1130) needs the same normalisation, otherwise it drops such a link as symlink_escape.

@bingran-you
bingran-you merged commit ce79d75 into benchflow-ai:main Oct 29, 2026
10 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Evidence capture rejects an absolute in-workspace symlink with '..' parts ("Unsafe evidence path"): a verified cell never gets a review

2 participants