Skip to content

feat(claude): agent-layer tool-use audit hook (SANDY_TOOL_AUDIT, HF Issue 6) - #92

Merged
rappdw merged 2 commits into
mainfrom
security/tool-use-audit
Jul 28, 2026
Merged

feat(claude): agent-layer tool-use audit hook (SANDY_TOOL_AUDIT, HF Issue 6)#92
rappdw merged 2 commits into
mainfrom
security/tool-use-audit

Conversation

@rappdw

@rappdw rappdw commented Jul 28, 2026

Copy link
Copy Markdown
Owner

HF-incident analysis Issue 6 (Medium — the post-mortem's single loudest defender recommendation; NONE disclosure — purely additive capability).

'Instrument the agent harness itself, not just external observability … external controls have no visibility into the agent itself' (EDR-vs-NDR). Sandy is otherwise entirely the NDR side. SANDY_TOOL_AUDIT=1 (passive-safe, default 0) turns on the EDR side.

  • Baked helper /usr/local/bin/sandy-tool-audit (next to sandy-claude-statusline): reads Claude Code's PreToolUse JSON on stdin, appends one {ts,tool,args} JSONL line to ~/.claude/tool-audit.jsonl. Always exits 0 (a non-zero PreToolUse hook would block the tool call); tool_input truncated to 200 chars.
  • Seeder: adds a PreToolUse hook only if the user has none (same only-if-absent guard as the statusLine default). Verified: off→none, on→seeded, host-configured-hook→preserved.
  • Passive key + metadata + regen; session-end pointer; SPEC Appendix A; CLAUDE.md doc with the two honest limits — Claude-only (no equivalent seam for codex/gemini/opencode) and not tamper-proof against a determined agent (runs in-box; telemetry for the primary wrong-but-not-evil adversary). run-tests.sh §82.

Pairs with Issue 4 (#91) to answer 'what did this session do' from both the network and harness sides. Additive; schema_version stays 1.

rappdw and others added 2 commits July 28, 2026 15:38
…ssue 6)

The post-mortem's loudest defender recommendation is 'instrument the agent harness
itself, not just external observability.' Sandy is otherwise entirely the NDR
side (constrains the box, sees no tool calls). This adds the EDR side.

- Bake /usr/local/bin/sandy-tool-audit into the base image (next to
  sandy-claude-statusline): reads Claude Code's PreToolUse JSON on stdin, appends
  one {ts,tool,args} JSONL line to ~/.claude/tool-audit.jsonl. ALWAYS exits 0 (a
  non-zero PreToolUse hook would block the tool call); args truncated to 200 chars.
- settings.json seeder: when SANDY_TOOL_AUDIT=1 (passive-safe), add a PreToolUse
  hook pointing at the helper — ONLY if the user has no PreToolUse hook of their
  own (same only-if-absent guard as the statusLine default). Verified: off->none,
  on->seeded, host-hook->preserved.
- SANDY_TOOL_AUDIT passive key + metadata + regen; session-end pointer in cleanup;
  SPEC Appendix A (baked helper); CLAUDE.md doc with the two honest limits
  (Claude-only; not tamper-proof vs a determined agent — telemetry for the
  primary adversary). run-tests.sh §82.

Additive; schema_version stays 1.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
# Conflicts:
#	CLAUDE.md
#	SPECIFICATION.md
@rappdw
rappdw merged commit 540d419 into main Jul 28, 2026
2 checks passed
@rappdw
rappdw deleted the security/tool-use-audit branch July 28, 2026 15:54
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