Skip to content

git branch -d bypasses review mode #257

@lamyc

Description

@lamyc

What happened

When reviewing a plan that includes git branch, the review mode only checks the command name. git branch -D <branch> executes without any confirmation, even though it deletes a branch. The current git branch is within BUILTIN_ALLOWLIST (here) for Repo inspection but didn't consider blocking high‑risk arguments.

Tested with a simple prompt: "delete branch feature/foo"

Expected

git branch -D should trigger review/confirmation because -D (force delete) is destructive. Ideally any command with high‑risk arguments (-d, -D, --force, rm -rf, etc.) should be held for approval.

Reproduction

  1. Start Reasonix with review mode enabled (default)
  2. Prompt: delete branch feature/foo
  3. Agent calls git branch -d feature/foo
  4. Command executes immediately without user confirmation

Environment

  • Reasonix version: 0.26.0
  • Node version: 24.12.0
  • OS: Linux (Ubuntu)
  • DeepSeek model: deepseek-v4-flash

Logs / transcript

› you · just now
git branch delete features/foo

◆  reasoning  · 1 ¶
The user wants to delete the `features/foo` branch. Let me do that.

✓ run_command git branch -d features/foo
$ git branch -d features/foo
[exit 0]
Deleted branch features/foo (was ab89d48).

No [Review] prompt appears before execution.

Possible direction

The OWASP AI Agent Security Cheat Sheet suggests checking dangerous tool parameters as part of tool‑call validation, not just the command name. There's a section on least privilege for tools that might be relevant here:

OWASP reference: AI Agent Security Cheat Sheet § 1. Tool Security – Least Privilege

One approach could be to extend the existing review logic with simple argument‑level checks (allowlist/blocklist patterns), so that commands like git branch -D get flagged just like their base names would.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions