Skip to content

Read-only agents can write files through bash #370

Backlog

Description

@commitshappen

What happens

The read-only definitions (reviewer, scout, dream-pass, and review-team reviewer-* definitions) get bash so they can run rg, git log, git show. Their instructions say "use bash for inspection only… never change files", but nothing enforces it: bash can write anywhere the host can.

Evidence

A reviewer run, in the middle of reviewing an extension in a project that is not a git repo, ran:

sed -i '' '/const attrsOf/,/return attrs/d' ~/.ultimate/extensions/<ext>/server.ts

plus node scripts that rewrote a second file under review, then tried to "restore" them. It deleted the wrong line range and left a stray } (a syntax error) that the coordinator only found by reading the reviewer's transcript, and fixed by hand.

Impact

A "read-only" pass can silently corrupt the code it is judging, and the verdict then describes code that no longer exists. Without git (no worktree, no diff to fall back on), the damage is hard to spot. Since an extension under ~/.ultimate/extensions/ hot-reloads, a bad write takes effect on the live host immediately.

Suggested fix

Give agents without edit/write a bash that cannot write: for example run their commands in a read-only sandbox (on macOS sandbox-exec with a deny file-write* profile, except /tmp; on Linux a read-only bind mount or landlock), or a readOnly flag on the bash tool that the definition loader sets when a definition has no edit/write. A command allow-list (rg, git log, …) is weaker, since git, node and redirections can still write.

Activity

  1. alfonso-noriega commented on Nov 25, 2026

    @alfonso-noriega

    A second case, with a bigger blast radius: a read-only dream-pass (instructions: "Read only… Use bash for inspection") wanted to read two git settings and ran

    git config core.sparseCheckout core.sparseCheckoutCone 2>/dev/null

    With two arguments git config sets the first key to the second, so it wrote sparseCheckout = core.sparseCheckoutCone into the repository's shared config, the one every worktree uses. From then on every git command in every worktree failed (fatal: bad boolean config value), and Ultimate blocked all tools but message in every branch for about an hour (filed separately as #378: the workspace check reported "missing or unregistered" instead of the git error). The 2>/dev/null hid the only sign at the time. Build af3d8e0e, long-running monorepo session.

    Two additions to the suggested fix:

    • The write sandbox would have caught this: the config lives in the repository's git dir, outside /tmp.
    • Until then, a one-line hint in agents/dream-pass.md L11 (and the other read-only definitions) costs nothing: "read git config only with git config --get <key>; the two-argument form writes."
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions