security_reminder_hook blocks documentation files with code examples
Bug Description
The security_reminder_hook.py from the security-guidance plugin blocks legitimate documentation files when they contain code examples demonstrating security patterns.
Steps to Reproduce
- Create a markdown file with technical architecture documentation
- Include code example showing safe alternative to child_process.e x e c()
- Attempt to write file with Write tool
- Hook blocks with security warning even though it's a markdown file
Expected Behavior
Documentation files (.md, .mdx, .txt, .rst) should be excluded from content-based security checks since they contain EXAMPLES, not actual executable code.
Actual Behavior
Hook scans all file content regardless of file type, blocking educational documentation.
Root Cause
File: ~/.claude/plugins/cache/claude-plugins-official/security-guidance/*/hooks/security_reminder_hook.py
Lines 244-250: Hook checks all Edit/Write/MultiEdit tools without excluding documentation files.
Proposed Fix
Add documentation file type exclusion before content checking (line 253):
# Skip documentation files (they contain code EXAMPLES, not actual code)
documentation_extensions = ('.md', '.mdx', '.txt', '.rst', '.asciidoc', '.adoc')
if file_path.lower().endswith(documentation_extensions):
sys.exit(0) # Allow documentation files with code examples
Impact
- Blocks PRD technical documentation (happens dozens of times per day)
- Prevents documenting security best practices in markdown
- Forces users to disable ALL security warnings as workaround (
ENABLE_SECURITY_REMINDER=0)
Workaround Currently Applied
Created .env with ENABLE_SECURITY_REMINDER=0 to disable ALL security warnings (not ideal).
Environment
- Plugin: security-guidance (claude-plugins-official)
- Hook: security_reminder_hook.py
- File blocked:
.agent/PRD/PRD-100/phase-3-technical-architecture.md - Claude Code: Latest version
Additional Context
This bug makes it impossible to write comprehensive PRD documentation that includes both unsafe and safe code patterns for educational purposes.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗