|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +This is a web application for viewing and managing security control overlays based on NIST SP 800-53 controls. It's designed for security professionals working with frontier AI development, displaying NIST controls with various security overlays including SL5 (Security Level 5), FedRAMP, CNSSI 1253, and others. |
| 8 | + |
| 9 | +## Architecture |
| 10 | + |
| 11 | +- **Frontend**: Single-page application using vanilla JavaScript embedded in `index.html` (no build process) |
| 12 | +- **Data Pipeline**: Python scripts extract data from PDF overlays → JSON files → JavaScript web app |
| 13 | +- **Hosting**: GitLab Pages (https://gitlab.com/sl5tf/control-overlays-selector) |
| 14 | + |
| 15 | +## Common Development Commands |
| 16 | + |
| 17 | +### Python Data Extraction |
| 18 | +```bash |
| 19 | +# Extract overlay data from PDFs (requires PyMuPDF/fitz) |
| 20 | +python sl5_overlay/extract_sl5_overlay.py sl5_overlay/sl5_overlay.pdf |
| 21 | +python cnssi_1253/extract_cnssi_1253.py cnssi_1253/cnssi_1253_overlay.pdf |
| 22 | +python classified_information/extract_classified_information_overlay.py classified_information/classified_information_overlay.pdf |
| 23 | + |
| 24 | +# Debug specific pages |
| 25 | +python sl5_overlay/extract_sl5_overlay.py sl5_overlay/sl5_overlay.pdf --debug-page 10 |
| 26 | + |
| 27 | +# Merge CNSSI data |
| 28 | +python cnssi_1253/cnssi_merger.py |
| 29 | + |
| 30 | +# Sort NIST controls naturally |
| 31 | +python nist_catalog/nist_sorter.py input.json output.json |
| 32 | +``` |
| 33 | + |
| 34 | +### Development |
| 35 | +- No build process - edit `index.html` directly |
| 36 | +- No package manager - pure vanilla JavaScript |
| 37 | +- Deploy by pushing to GitLab (configured in `.gitlab-ci.yml`) |
| 38 | + |
| 39 | +## Code Structure |
| 40 | + |
| 41 | +### Frontend (`index.html`) |
| 42 | +- **Data Loading**: `loadData()` fetches all JSON files |
| 43 | +- **Rendering**: `renderControls()` displays filtered controls |
| 44 | +- **State**: Global variables store control data and overlay states |
| 45 | +- **Events**: Toggle overlays, search, filter by family, expand/collapse controls |
| 46 | + |
| 47 | +### Data Pipeline |
| 48 | +Each overlay directory contains: |
| 49 | +- PDF source document |
| 50 | +- Python extractor script (`extract_*.py`) |
| 51 | +- Generated JSON data file |
| 52 | +- Common pattern: PDF → Python extractor → JSON → Web app |
| 53 | + |
| 54 | +### Key Data Structures |
| 55 | +```javascript |
| 56 | +// Control format |
| 57 | +{ |
| 58 | + "id": "AC-1", |
| 59 | + "text": "Control description...", |
| 60 | + "family": "Access Control", |
| 61 | + "enhancements": [...], |
| 62 | + "discussion": "..." |
| 63 | +} |
| 64 | + |
| 65 | +// Overlay format varies by type |
| 66 | +// SL5: {"selected": true/false, "attributes": {...}} |
| 67 | +// CNSSI: {"control_text": "", "defined_value": "", "selected": true/false} |
| 68 | +``` |
| 69 | + |
| 70 | +## Important Patterns |
| 71 | + |
| 72 | +1. **Control ID Format**: `[A-Z]{2}-\d{1,2}` (base) or `[A-Z]{2}-\d{1,2}\(\d+\)` (enhancement) |
| 73 | +2. **Overlay Toggle Logic**: Each overlay can be enabled/disabled, affecting control visibility |
| 74 | +3. **Enhancement Display**: Controls with enhancements have expandable sections |
| 75 | +4. **Modal System**: Click control IDs to preview in modal |
| 76 | +5. **Natural Sorting**: Controls sorted as AC-1, AC-2, ..., AC-10 (not lexically) |
| 77 | + |
| 78 | +## Adding New Overlays |
| 79 | + |
| 80 | +1. Create directory for new overlay |
| 81 | +2. Add PDF source document |
| 82 | +3. Create Python extractor following existing patterns (see `sl5_overlay/extract_sl5_overlay.py` as template) |
| 83 | +4. Generate JSON data |
| 84 | +5. Add overlay loading in `loadData()` function |
| 85 | +6. Add toggle UI in overlay panel |
| 86 | +7. Update `getOverlayInfo()` to handle new overlay format |
| 87 | + |
| 88 | +## Testing |
| 89 | + |
| 90 | +No automated tests exist. Manual testing process: |
| 91 | +1. Run Python extractors on PDFs |
| 92 | +2. Verify JSON output structure |
| 93 | +3. Load in browser and test filtering/toggling |
| 94 | +4. Check control display and enhancements |
| 95 | +5. Test search functionality |
| 96 | + |
| 97 | +## Dependencies |
| 98 | + |
| 99 | +- **Python**: PyMuPDF (fitz) for PDF extraction |
| 100 | +- **JavaScript**: None (vanilla JS only) |
| 101 | +- **Deployment**: GitLab Pages via CI/CD |
0 commit comments