From 95aa2b34779d4076d2005d56e0a280f5d649bad8 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 16 Oct 2026 20:32:36 +0200 Subject: [PATCH] =?UTF-8?q?Answer=20security=20round=202:=201=20?= =?UTF-8?q?=F0=9F=94=B4,=200=20=F0=9F=9F=A1;=20deny=20a=20git=20argument?= =?UTF-8?q?=20that=20names=20a=20path=20outside=20the=20clone,=20in=20plac?= =?UTF-8?q?e=20of=20listing=20options?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 +- workflow-bench/bench.py | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8f25d38..a8152ca7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## Unreleased -- `workflow-bench/bench.py` gives each run a fixed list of allowed tools, where it skipped every permission check. A run may launch agents, run `/security-review`, edit its clone (not the clone's `.git/`) and its report, read its clone and the copy of `~/.claude` it benches, and run `git log`, `diff`, `show`, `status`, `ls-files`, `add` and `commit -m`, without options that name a path git reads or writes. It loads no user settings, so `~/.claude/settings.json`'s hooks and extra directories do not apply to it. Every other call is denied. Expect a benched review that needs to run a project's code or tests to say in its report that it could not. +- `workflow-bench/bench.py` gives each run a fixed list of allowed tools, where it skipped every permission check. A run may launch agents, run `/security-review`, edit its clone (not the clone's `.git/`) and its report, read its clone and the copy of `~/.claude` it benches, and run `git log`, `diff`, `show`, `status`, `ls-files`, `add` and `commit -m` (also as `-am` or `-a -m`). A git argument that names a path outside the clone is denied: an absolute path, one from `~`, one through `..` or one through a shell variable. It loads no user settings, so `~/.claude/settings.json`'s hooks and extra directories do not apply to it. Every other call is denied. Expect a benched review that needs to run a project's code or tests to say in its report that it could not. - Every goal in `README.md` → Goals is marked `**Maintain:**`, a state to hold, or `**Achieve:**`, a direction to pursue. Each achieve goal has a signal, a counter-signal and a one-line reason under it. A change that breaks a maintain goal is redesigned or dropped, whatever it scores: `rules/todo-items.md` says so, and larv-review's goal alignment step no longer merges such a PR. `rules/goals-and-audience.md` states the form for every project's README. Expect larv-review to stop a PR on a maintain goal where it asked you before. - Reshape every project's `todo.md` to the new shape below: until it is reshaped, that is the project's only work, as it is while README.md lacks Goals and Audience, and `rank_todo.py` says so. First move every machine to this release: an older release rejects the new formula, so it fails on every reshaped `todo.md`. Then mark the README's goals `**Maintain:**` or `**Achieve:**`, score each item's L, E and I, and set a bar on the new scale below the score of every item to keep, since the old bar would drop most items. Until then, an old-shape `todo.md` still ranks by its own formula and weights. - `todo.md` ranks items by value per cost: this setup's own plan uses `Score = 100 * V / (2**S + 8)`, where 8 is a chunk's fixed cost, about one size-3 change, and `rank_todo.py --help` shows it. A Moves column replaces A, G and Goals, naming each achieve goal an item moves and how far, such as `1.1 by 8, 1.2 by 5`. V sums each named goal's weight times its move. `rank_todo.py` weighs each achieve goal by its position in README.md, the first heaviest, so the goal weights table goes. An item names the most specific goal it moves, never a goal beside its own sub-goal. `rules/todo-items.md` and `rank_todo.py --help` show the new shape. diff --git a/workflow-bench/bench.py b/workflow-bench/bench.py index e792dcc4..4f656d33 100755 --- a/workflow-bench/bench.py +++ b/workflow-bench/bench.py @@ -37,14 +37,17 @@ def permission_flags(clone, version_dir, report): """The tools a review needs, each limited to what it may touch; the run denies every other call.""" # A permission rule writes an absolute path as "//"; a trailing "/**" matches everything under it. trees = (f"/{clone}/**", f"/{version_dir}/**") - git = ("log", "diff", "show", "status", "ls-files", "add", "commit -m", "commit -am") + commands = ("log", "diff", "show", "status", "ls-files", "add", "commit -m", "commit -am", "commit -a -m") allowed = [ "Agent", "Skill(security-review)", f"Edit(/{clone}/**)", f"Edit(/{report})", - *(f"Bash(git {command} *)" for command in git), + *(f"Bash(git {command} *)" for command in commands), *(f"{tool}({tree})" for tool in ("Read", "Grep", "Glob") for tree in trees), ] - # git reads or writes any path through these options, and runs any command through a hook or config. - denied = [f"Edit(/{clone}/.git/**)", *(f"Bash(git * {option}*)" for option in ("--no-index", "--output", "-F", "--file", "-t", "--template"))] + # git reaches a path outside the clone only through an argument that names one: absolute, from ~, up + # through "..", through a variable, or glued to -O or -X. With -m, git refuses -F and ignores -t + # before reading either file. An edit to .git/ could add a hook, which runs any command. + outside = (" /", "=/", " ~", "=~", "../", " ..", "$", "O/", "X/") + denied = [f"Edit(/{clone}/.git/**)", *(f"Bash(git *{shape}*)" for shape in outside)] # Only the clone's own settings: the user's add every checkout under ~/code to the readable trees. return ["--setting-sources", "project,local", "--permission-mode", "dontAsk", "--permission-prompts", "none", "--allowedTools", *allowed, "--disallowedTools", *denied]