Skip to content

fix(review): reviews run nothing from, and take no conventions from, the tree under review #946

Closed

Description

@dan-petty

Problem

A review must treat the tree it reviews as untrusted, but three paths run its code or follow its instructions. Found while analysing review session 20261001-224227 (2026-10-02).

  1. Code execution from the reviewed tree (HIGH).
    • _module_typechecks_clean (ai/review/verification.py:1109-1127) runs ["uv", "run", "mypy", "--strict", <cited file>] outside the sandbox, with no cwd, so it runs wherever the CLI was started.
    • Started inside a repository under review, uv run syncs that project and runs its build backend, and mypy loads that project's config and plugins.
    • The loop analysis probed it: a repository with an in-tree backend.py had it executed by uv run mypy.
    • Trigger: any finding phrased as a None dereference on a .py file (_check_none_dereference_hallucination).
  2. A branch can loosen its own review (LOW).
    • devops review branch reads AGENTS.md and .devops/review.md from the branch's working tree: pipeline.py:2150-2178, with target_dir=repo_path at commands/review.py:544.
    • It puts them into the persona system prompt ("Adhere to target project conventions", classification.py:62-71) and into the verifier.
    • So a branch written by an agent or a contributor can add exemptions that suppress findings about itself.
    • PR reviews already take conventions from the base revision (runner.py:1984-2012), and branch reviews should match.
  3. Corpus reviews inherit devops-cli's conventions.

Acceptance criteria

  • The type probe runs nothing from the target. It runs [sys.executable, "-m", "mypy", "--strict", "--no-incremental", "--config-file", <empty temp ini>, <file>] with cwd set to a temporary directory, or it is skipped when the cited file is outside devops-cli's own source tree.
    • Test 1: patch run_subprocess and assert argv[0] is not uv, --config-file is present, and cwd is outside the target.
    • Test 2: a temp repository with an in-tree build backend that writes a marker. _check_none_dereference_hallucination on a None-dereference finding there writes no marker.
  • Branch reviews take conventions from the base revision (the merge base), as PR reviews do. Test: a branch that adds an exemption to .devops/review.md does not see it in its own persona or verifier prompt.
  • The conventions lookup stops at a corpus root (its manifest marks it), and profile.json records a digest of the conventions used. Test: a corpus generated under a temp repository containing .devops/review.md reads no conventions.
  • uv run devops ci passes.

Key questions

  • Skip the type probe for files outside devops-cli, or isolate it? Isolate it (proposed): an empty config and a temp cwd keep the guard useful for any Python target, and nothing from the target runs.
  • Is this a critical fix? Yes: a security fix for a code-execution path.

Activity

  1. added this to the v0.2.25 milestone on Oct 2, 2026
  2. added
    type/security
    scope/review
    priority/p1-high
    on Oct 2, 2026
  3. dan-petty commented on Oct 2, 2026

    @dan-petty
    OwnerAuthor

    Closed by #976, merged into release/v0.2.25.

    GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by devops gh issues close-merged.

  4. added a commit that references this issue on Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p1-highscope/reviewtype/security

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions