Skip to content

security(hooks): dead code cleanup + injection scanner hardening (ADR-116, ADR-121)#198

Merged
notque merged 1 commit intomainfrom
feat/adr-116-121-final
Mar 28, 2026
Merged

security(hooks): dead code cleanup + injection scanner hardening (ADR-116, ADR-121)#198
notque merged 1 commit intomainfrom
feat/adr-116-121-final

Conversation

@notque
Copy link
Copy Markdown
Owner

@notque notque commented Mar 28, 2026

Summary

ADR-116: Dead Code Cleanup

  • Delete scripts/validate-agent-references.py (150 lines, zero references anywhere)

ADR-121: Injection Scanner Hardening

  • New: hooks/lib/injection_patterns.py — shared injection pattern library extracted from scanner
  • New: hooks/posttool-bash-injection-scan.py — PostToolUse hook scanning file writes via Bash (echo >, tee, cp)
  • Modified: hooks/pretool-prompt-injection-scanner.py — now uses shared pattern library
  • Modified: hooks/pretool-dangerous-command-guard.py — whitelist entry min length (8 chars) + load logging
  • Modified: hooks/pretool-unified-gate.py — same whitelist hardening

Advisory-only behavior preserved for all scanning hooks.

Test Plan

  • Shared pattern library extracts cleanly from scanner
  • Whitelist entries < 8 chars rejected with warning
  • Whitelist load produces INFO log to stderr
  • New PostToolUse hook is advisory only (exit 0)
  • Dead script confirmed unreferenced via grep

…on scanning (ADR-116, ADR-121)

ADR-116: Delete scripts/validate-agent-references.py (completely unreferenced)

ADR-121: Injection scanner hardening
- Extract shared injection patterns into hooks/lib/injection_patterns.py
- Update pretool-prompt-injection-scanner.py to use shared library
- Add posttool-bash-injection-scan.py for scanning file writes via Bash
- Add whitelist entry length validation (min 8 chars) and load logging
  in pretool-dangerous-command-guard.py and pretool-unified-gate.py
@notque notque merged commit 26a9e44 into main Mar 28, 2026
2 of 4 checks passed
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