TheFlow
|
b9a301f2a7
|
feat(security): implement attack surface exposure prevention (inst_084)
Adds comprehensive protection against exposing internal implementation
details in public-facing documentation.
New Governance Rule (inst_084):
- Quadrant: SYSTEM
- Persistence: HIGH
- Scope: Public documents (confidential:false)
- Enforcement: Pre-commit hooks (mandatory)
Implementation:
1. attack-surface-validator.util.js
- Pattern detection for file paths, API endpoints, admin URLs, ports
- Frontmatter parsing (respects confidential:true exemption)
- Code block exemption (doesn't flag technical examples)
- Intelligent line numbering for violation reporting
2. check-attack-surface.js
- Pre-commit script that scans staged documents
- User-friendly violation reporting with suggestions
- Integration with git workflow
3. Pre-commit hook integration
- Added as Check #3 in git hooks
- Runs after prohibited terms, before test requirements
- Blocks commits with attack surface exposures
Detection Patterns:
✅ File paths: src/*, public/*, scripts/*
✅ API endpoints: /api/*, /admin/*
✅ File naming patterns: *.util.js, *.service.js
✅ Port numbers in prose
✅ Connection strings
Exemptions:
- Code blocks (```)
- Inline code (`)
- Confidential documents (confidential:true)
- Internal technical documentation
Security Rationale (Defense-in-Depth):
- Prevents reconnaissance by obscuring architecture
- Reduces attack surface by hiding implementation paths
- Complements credential protection (inst_069/070)
- Part of layered security strategy (inst_072)
Testing:
- Validated against test document with known exposures
- 7 violations detected correctly
- Code block exemption verified
- All expected pattern types detected
Example Violations Blocked:
❌ "Dashboard at /admin/audit-analytics.html"
✅ "Administrative Dashboard"
❌ "GET /api/admin/audit-logs endpoint"
✅ "Authenticated API for audit data"
❌ "In activity-classifier.util.js"
✅ "The activity classifier"
This enforcement prevented the exact security issue discovered in
governance-bi-tools.md which exposed admin paths and API endpoints.
Also fixed prohibited terms checker to exempt instruction-history.json
(which contains prohibited term DEFINITIONS, not violations).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-10-27 12:11:43 +13:00 |
|