Skip to content

Ask only for effects that escape the sandbox #162

Closed

Description

@furedea

Purpose

Reduce permission prompts to the cases whose effects escape the sandbox or cannot be undone. The OS sandbox is now the hard boundary (writes limited to the worktree and temp directories, network limited to allowed domains, credential paths unreadable), so prompting for script execution, in-place edits, and read-only inspection inside it buys no safety and costs a prompt every time.

Audit evidence (2026-10-15, after #159 was deployed): 94 hook escalations in one afternoon, 82 of them "syntax" (a glob, $VAR, $(...), or heredoc anywhere in the call), the rest grep/rg/cat arguments that merely contain \ or $ inside quotes. python3 <script>, python3 -c, and uv run python prompt on every call through the ask rules or the auto-mode classifier, and the classifier also denied a read-only grep today.

Scope

  1. Allow sandboxed script execution: python3, python, node, uv run python, uv run --frozen python, including -c/-e one-liners. Keep uvx, npx, pnpm dlx, bunx, dependency changes, nix run/shell/develop, and the sandbox escape in ask. Deny python -m pip like pip.
  2. Judge read-only inspection commands structurally instead of by regex: a command whose program is in a read-only set (rg, grep, cat, bat, head, tail, nl, wc, ls, eza, fd, find, stat, file, jq, diff, sort, uniq, cut, tr, which, echo, printf, pwd, date, true, false, test, basename, dirname, realpath, readlink, seq, env) is allowed when it has no redirection to a file; its arguments may contain globs or variables. Command substitution, process substitution, and heredocs still escalate. Globs and variables in any other command still escalate, and a deny prefix that matches literally (rm -rf $DIR) still denies.
  3. Allow the trivial builtins above so they no longer reach the classifier.
  4. Allow in-place edits that the sandbox confines to the worktree: sed -i, perl -i, tee, truncate. rm stays in ask because untracked files cannot be recovered.
  5. Record the decision as ADR-0034, superseding ADR-0031's ask tier, and update the README paragraph.

Out of scope

  • The agent-harness renderer.
  • Classifier behavior itself; the goal is to reach it less often.

Acceptance criteria

  • uv run --frozen pytest tests/agents passes.
  • rg -n "def \w+" agents, rg foo *.py, cat $FILE, and ls -la ~/x are allowed by guard_command.py allowed; rg foo > out.txt, cat $(x), git push $FLAGS origin main, and cd $DIR still escalate; rm -rf $DIR is still denied.
  • python3 scripts/x.py, python3 -c 'print(1)', and uv run --frozen python x.py are allowed without a prompt; uvx ruff and npx cowsay still ask; python3 -m pip install x is denied.
  • Every new allow prefix has a precise rule or a structural entry, and the generated Claude permissions match.

Activity

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