Skip to content

fix(protected-path): deny agent writes to the harness state dir and HMAC key - #142

Merged
brunoazoulay merged 3 commits into
mainfrom
test/receipt-tamper
Nov 17, 2026
Merged

brunoazoulay merged 3 commits into
mainfrom
test/receipt-tamper

Conversation

@brunoazoulay

Copy link
Copy Markdown
Collaborator

Summary

  • Protected-path guard denies agent Write/Edit and Bash writes to ~/.fuse-harness/state/ and ~/.fuse-harness/.key (normalised match: //, /./, /../ cannot hide them). Legacy protected paths keep their exact verdicts; reads stay allowed. The harness's own writes run inside the hook process, never through a tool call.
  • Tightening only (listed): writes to the harness state dir / HMAC key go allow (or ask) -> deny.

Real hook run (built dist/cli/bin.mjs, hook claude-code, sandbox HOME)

Payload base a592b70 this branch
Write state track allow deny
Write .key allow deny
Write state via /./ and /../ allow deny
Bash echo {} > state track ask deny
Bash cp /tmp/k .key allow deny
Bash ls state dir (control) allow allow
Write project README.md (control) allow allow
Bash echo hi > scratch file (control) deny deny

Test plan

  • Full bun test + tsc --noEmit locally vs origin/main baseline
  • CI green

…MAC key

- protected-path-targets/commands: normalised match on ~/.fuse-harness/state/ and
  ~/.fuse-harness/.key for Write/Edit and precise Bash write-target extraction
  (`//`, `/./`, `/../` cannot hide them); legacy protected paths keep their verdicts
- paths.ts: document the guard; reads stay allowed
- tests: receipt-tamper data, guards, hosts; protected-path-new
securityGuard returned the generic rm ASK before protectedPathGuard could
deny, so rm of the harness state dir/HMAC key was a liftable ask on Linux
and real macOS homes — macOS CI passed only via the unrelated /var
system-dir rule. denyOverAsk only turns ask->deny for receipt-store
targets. Receipt-tamper tests updated to the #141 hash-chain truth.
@brunoazoulay
brunoazoulay merged commit 70095b3 into main Nov 17, 2026
1 check passed
@brunoazoulay
brunoazoulay deleted the test/receipt-tamper branch November 17, 2026 09:02
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.

1 participant