Skip to content

fix(p0-7): run_validation default-safe output + symlink-resistant containment#433

Merged
0xmariowu merged 12 commits intomainfrom
fix/p0-7-run-validation-output-guard
Apr 26, 2026
Merged

fix(p0-7): run_validation default-safe output + symlink-resistant containment#433
0xmariowu merged 12 commits intomainfrom
fix/p0-7-run-validation-output-guard

Conversation

@0xmariowu
Copy link
Copy Markdown
Owner

Summary

P0 fix for reports/autosearch-p0-fix-plan.md §7 — scripts/e2b/run_validation.py --output <dir> previously rmtree'd the existing output directory at startup. Pointing --output at a sensitive dir (e.g. home) destroyed data without warning.

Changes

  1. Default-safe: output goes to <output>/run-<timestamp>/ subdir. Existing files never deleted.
  2. Opt-in delete: new --clean-output flag is required to allow rmtree. Without it, no delete.
  3. Containment: --clean-output only allowed when <output> is inside the repo's reports/ root. Reports root derived via Path(__file__).resolve().parents[N] / "reports" (not hardcoded — repo-relative).
  4. Symlink resistance: BOTH <output> and reports_root go through .resolve() before is_relative_to(...) comparison. Tests cover symlink escape (target outside reports_root) and symlink-as-reports-root.

Plan

docs/exec-plans/active/autosearch-0426-p0-fix-plan-execution.md § F009 (S1-S5).

Commits

  • 39d8d29 test scaffold (S1)
  • ab10c2f default no-delete + run- subdir (S2)
  • 7834fdf --clean-output flag (S3)
  • 01671a5 containment to repo reports/ (S4)
  • a0d3c57 double-resolve symlinks (S5)
  • 570d4b4 style: format tests (Codex follow-up)

Test plan

  • pytest tests/scripts/test_e2b_run_validation_output.py — 5 passed
  • pytest tests/scripts/ — 31 passed
  • pytest tests/unit/ -m "not real_llm and not slow and not network" — 673 passed, 3 skipped
  • ruff clean

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings April 26, 2026 11:35
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 26, 2026

Warning

Rate limit exceeded

@0xmariowu has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 56 minutes and 6 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 56 minutes and 6 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 35593fda-439f-452c-93a9-5023781a7a39

📥 Commits

Reviewing files that changed from the base of the PR and between ef940c1 and e460f28.

📒 Files selected for processing (3)
  • autosearch/skills/channels/papers/methods/via_paper_search.py
  • scripts/e2b/run_validation.py
  • tests/scripts/test_e2b_run_validation_output.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Addresses a high-impact safety issue in scripts/e2b/run_validation.py where --output could lead to destructive deletion of an existing directory, by making output handling default-safe and constraining deletion to a repo-controlled reports area.

Changes:

  • Writes each run into a new <output>/run-<timestamp>/ directory by default (no deletion of existing output).
  • Adds --clean-output as an explicit opt-in to delete the base output directory.
  • Restricts --clean-output to output paths contained within the repo’s reports/ root, with additional symlink-resistant resolution checks, and adds tests for these behaviors.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
scripts/e2b/run_validation.py Implements default-safe per-run subdirs, adds --clean-output, and enforces containment within repo reports/ with resolved-path checks.
tests/scripts/test_e2b_run_validation_output.py Adds coverage for non-deletion by default, opt-in deletion, containment enforcement, and symlink escape scenarios.

Comment thread tests/scripts/test_e2b_run_validation_output.py
@0xmariowu 0xmariowu enabled auto-merge (squash) April 26, 2026 12:32
@github-actions
Copy link
Copy Markdown
Contributor

@copilot please address the blocking signals on this PR and push a fix commit.

Trigger: ci-failure
Details: Workflow "CI" failed on run 24956911799

Follow the PR's .github/copilot-instructions.md hard rules. Do not suppress lints, skip tests, or weaken CI.

@0xmariowu 0xmariowu merged commit 872de34 into main Apr 26, 2026
14 checks passed
@0xmariowu 0xmariowu deleted the fix/p0-7-run-validation-output-guard branch April 26, 2026 13:18
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.

2 participants