Skip to content

feat(gate): an agent editing the policy that gates it is stopped (0.2.16) - #145

Merged
chrispezza merged 1 commit into
mainfrom
claude/gate-policy-file-141
Oct 12, 2026
Merged

chrispezza merged 1 commit into
mainfrom
claude/gate-policy-file-141

Conversation

@chrispezza

Copy link
Copy Markdown
Contributor

What

An agent could rewrite the policy that gates it and nothing objected. A Write or Edit of ~/.bouncer/bouncer.yaml or a repository's .bouncer.yaml was judged ask, and in seatbelt a judged ask reaches nobody. One installed log holds two such edits.

  • A label. describeSensitivity returns gate_policy for the two names resolvePolicy looks for.
  • A predicate. target_labelled is true when the file a Write, Edit or NotebookEdit would change carries a label. Every hard-rule predicate until now read a command line, so no entry could see those tools.
  • Three shipped entries that read the label, shipped as ask like every entry:
entry catches
edits-the-gate-policy every Write and Edit of the file
removes-or-overwrites-the-gate-policy rm, unlink, shred, mv, truncate, tee on it
edits-the-gate-policy-in-place sed -i, perl -i on it

The decision in it

In guard and full the edit prompts. In seatbelt it is denied, and the way through is to edit the file yourself. That is friction, chosen: the mode is for sessions nobody is watching, and this is the file that says what such a session may not do. ADR-013 has the argument, and ADR-012 decides the opposite for this repository's own records.

What it does not catch

cp onto the file, a redirect onto it, and a script. cp is left out because the verb cannot say which argument is written, and the same command with its arguments swapped is a backup. Both gaps are in the frozen holdout as named dangerous false accepts, so the suite asserts them. Reading the policy is not stopped.

Flagged

Cost

Paired bench against the base commit's bundle and policy, 50 pairs, M4:

case paired median limit
judged +0.2% +10%
hard-rule -0.6% +10%

Three entries are YAML nodes, about 0.37 ms each on a cold parse and nothing cached. No Jev call, no D1, one CI run.

Verified

npm test: 36 files, 1551 tests. npm run typecheck clean. Bundle rebuilt. The holdout expectations were read off the built hook, not assumed.

Closes #141

🤖 Generated with Claude Code

….16)

A Write or Edit of ~/.bouncer/bouncer.yaml or a repository's .bouncer.yaml
was judged `ask`, and in seatbelt a judged ask reaches nobody, so a session
under --dangerously-skip-permissions could set `mode: observe` and carry on
ungated. One installed log holds two such edits.

- describeSensitivity labels the two names resolvePolicy looks for as
  `gate_policy`.
- A new hard-rule predicate, `target_labelled`, is true when the file a
  Write, Edit or NotebookEdit would change carries a label. Every predicate
  until now read a command line, so no entry could see those tools.
- Three shipped entries read the label: every Write and Edit of the file,
  the shell verbs that can only be removing or overwriting it, and an
  in-place sed or perl. They ship as ask; seatbelt denies.

Reading the policy is not stopped. `cp` onto the file, a redirect onto it
and a script are not caught, and are in the frozen holdout as named
dangerous false accepts rather than left out.

ADR-013 records the decision and amends ADR-004; it settles the question
ADR-012 decision 4 left open. CACHE_VERSION 7 -> 8 for the new field.

Paired bench against the base bundle and policy, 50 pairs: judged +0.2%,
hard-rule -0.6%, against a 10% limit.

Closes #141

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chrispezza
chrispezza merged commit 2ab43d7 into main Oct 12, 2026
2 checks passed
@chrispezza
chrispezza deleted the claude/gate-policy-file-141 branch October 12, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The gate's own policy file can be edited from inside a gated session, and seatbelt says nothing

1 participant