WriteGuard covers only the Write tool; Edit and Bash bypass the role scopes #474

Closed
opened 2026-08-21 19:18:20 +00:00 by jared · 2 comments
Owner

Context

Blueprint §9 close-out check (#468) found criteria 4 and 5 only partially met: the three-scope WriteGuard (#466) gates the Write tool, but agents/test-writer.md grants Edit and Bash, and programmer/refactorer grant Bash — a test-writer can Edit production files and any writer role can shell-write; the no-test-run/no-lint-run rules are prose-only. Fix path: extend the guard hook to Edit (same role×path table) and decide whether Bash gets command-pattern gating or the tool grants get narrowed in agent frontmatter.

Skeptic verdict: CREATE — real enforcement gap, distinct root, validation hard floor.

Origin

  • Trigger: #468 blueprint-§9 acceptance check (2026-08-21), criteria 4-5 partial.
  • Improvised this session: none.
  • Chain: prose-only enforcement ← guard keyed to tool_name Write only (write_guard.rb) ← DESIGN (#466 implemented the spec's stated Write-guard scope).
  • Root candidate: this ticket.
## Context Blueprint §9 close-out check (#468) found criteria 4 and 5 only partially met: the three-scope WriteGuard (#466) gates the Write tool, but agents/test-writer.md grants Edit and Bash, and programmer/refactorer grant Bash — a test-writer can Edit production files and any writer role can shell-write; the no-test-run/no-lint-run rules are prose-only. Fix path: extend the guard hook to Edit (same role×path table) and decide whether Bash gets command-pattern gating or the tool grants get narrowed in agent frontmatter. Skeptic verdict: CREATE — real enforcement gap, distinct root, validation hard floor. ## Origin - Trigger: #468 blueprint-§9 acceptance check (2026-08-21), criteria 4-5 partial. - Improvised this session: none. - Chain: prose-only enforcement ← guard keyed to tool_name Write only (write_guard.rb) ← DESIGN (#466 implemented the spec's stated Write-guard scope). - Root candidate: this ticket.
Author
Owner

Work started on branch 473-474-guards. Design: WriteGuard extends to Edit; new BashGuard denies judges on write-shaped commands and writer roles on out-of-scope extractable targets (fail-open otherwise, boundary documented in tests); shared ScopePolicy extracted; hook matcher ^(Write|Edit|Bash)$; hook-level subprocess tests. Codex-reviewed package.

Work started on branch 473-474-guards. Design: WriteGuard extends to Edit; new BashGuard denies judges on write-shaped commands and writer roles on out-of-scope extractable targets (fail-open otherwise, boundary documented in tests); shared ScopePolicy extracted; hook matcher ^(Write|Edit|Bash)$; hook-level subprocess tests. Codex-reviewed package.
Author
Owner

Resolution

Done: PreToolUse guard now covers Edit (WriteGuard MUTATING_TOOLS) and Bash (new BashGuard: judges denied on any mutation evidence incl. fd redirects, >|, tee, sed/perl -i, mutating segment-head executables; writer roles denied on out-of-scope extractable targets, fail-open otherwise). Role/scope rules unified in ScopePolicy; hook matcher ^(Write|Edit|Bash)$; hook subprocess + manifest under direct test.

Evidence: Commits 63e06f6 + 7283e51, merged 2d4babe on main; ADR-0156 amends ADR-0138/0126; new tests bash_guard_test.rb, tests/hooks/pre_tool_use_hook_test.rb, Edit rows in write_guard_scope_test.rb; full suite 1218 runs 0 failures; plugin cache refreshed.

Follow-ups: none — Bash sieve blind spots (git commit, ruby -e File.write) are the declared boundary per ADR-0156, documented by allow-tests; deliberately not hardened

## Resolution **Done:** PreToolUse guard now covers Edit (WriteGuard MUTATING_TOOLS) and Bash (new BashGuard: judges denied on any mutation evidence incl. fd redirects, >|, tee, sed/perl -i, mutating segment-head executables; writer roles denied on out-of-scope extractable targets, fail-open otherwise). Role/scope rules unified in ScopePolicy; hook matcher ^(Write|Edit|Bash)$; hook subprocess + manifest under direct test. **Evidence:** Commits 63e06f6 + 7283e51, merged 2d4babe on main; ADR-0156 amends ADR-0138/0126; new tests bash_guard_test.rb, tests/hooks/pre_tool_use_hook_test.rb, Edit rows in write_guard_scope_test.rb; full suite 1218 runs 0 failures; plugin cache refreshed. **Follow-ups:** none — Bash sieve blind spots (git commit, ruby -e File.write) are the declared boundary per ADR-0156, documented by allow-tests; deliberately not hardened
jared closed this issue 2026-08-26 22:46:23 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jared/cc-os#474
No description provided.