security_reminder_hook blocks documentation files with code examples

Resolved 💬 3 comments Opened Dec 31, 2025 by cloud-devops-expert Closed Jan 4, 2026

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

  1. Create a markdown file with technical architecture documentation
  2. Include code example showing safe alternative to child_process.e x e c()
  3. Attempt to write file with Write tool
  4. 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.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗