|
| 1 | +# NIST 800-53 Control Viewer & Gap Analysis |
| 2 | + |
| 3 | +Interactive web-based viewer for NIST 800-53 control files with comprehensive gap analysis and backlog management features. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +### Dashboard View |
| 8 | +- **Overall Coverage Statistics**: Total controls, automated, manual, and pending counts with percentages |
| 9 | +- **Gap Analysis**: Visual representation of controls without rules |
| 10 | +- **Product Comparison**: Side-by-side comparison of rhel8, rhel9, and rhel10 coverage |
| 11 | +- **Family Coverage Chart**: Bar chart showing automation coverage by control family |
| 12 | +- **Baseline Level Breakdown**: Distribution across LOW, MODERATE, and HIGH baselines |
| 13 | +- **Top Gaps List**: Quick view of controls that need rule implementation |
| 14 | + |
| 15 | +### Controls View |
| 16 | +- **Advanced Filtering**: |
| 17 | + - Filter by control family (AC, AU, CM, IA, SC, SI, etc.) |
| 18 | + - Filter by baseline level (Low, Moderate, High) |
| 19 | + - Filter by status (Automated, Manual, Pending) |
| 20 | + - Filter by gap status (With Rules, Without Rules) |
| 21 | + - Full-text search across control IDs, titles, and descriptions |
| 22 | + |
| 23 | +- **Control Details**: |
| 24 | + - OSCAL metadata (description, guidance, parameters) |
| 25 | + - Implementation status |
| 26 | + - Rule listings |
| 27 | + - Related controls with clickable links |
| 28 | + - Baseline level applicability |
| 29 | + |
| 30 | +- **Backlog Management**: |
| 31 | + - Add TODO items per control |
| 32 | + - Mark items as complete |
| 33 | + - Delete completed items |
| 34 | + - Persistent storage in browser localStorage |
| 35 | + |
| 36 | +## Building the Viewer |
| 37 | + |
| 38 | +### Using CMake (Recommended) |
| 39 | + |
| 40 | +```bash |
| 41 | +# Build everything including the NIST viewer |
| 42 | +cd build |
| 43 | +cmake .. -G Ninja |
| 44 | +ninja nist-viewer |
| 45 | + |
| 46 | +# The viewer will be generated at: |
| 47 | +# build/nist-controls-viewer/nist-controls-viewer.html |
| 48 | +``` |
| 49 | + |
| 50 | +### Manual Generation |
| 51 | + |
| 52 | +```bash |
| 53 | +cd utils/nist_sync |
| 54 | + |
| 55 | +# Generate the viewer for specific products |
| 56 | +python3 generate_nist_viewer.py \ |
| 57 | + --products rhel8 rhel9 rhel10 \ |
| 58 | + --output-dir ../../build/nist-controls-viewer \ |
| 59 | + --repo-root ../.. |
| 60 | + |
| 61 | +# Open the viewer |
| 62 | +open ../../build/nist-controls-viewer/nist-controls-viewer.html |
| 63 | +``` |
| 64 | + |
| 65 | +## Published Version |
| 66 | + |
| 67 | +The viewer is automatically published to GitHub Pages via the `gh-pages` workflow: |
| 68 | + |
| 69 | +**URL**: https://complianceascode.github.io/content-pages/nist-viewer/nist-controls-viewer.html |
| 70 | + |
| 71 | +The published version updates automatically when changes are pushed to the master branch. |
| 72 | + |
| 73 | +## Data Structure |
| 74 | + |
| 75 | +The viewer has all control data embedded directly in the HTML file (as `EMBEDDED_DATA` JavaScript constant). This allows the viewer to work when opened directly as a local file without CORS issues. |
| 76 | + |
| 77 | +A separate `nist-controls-data.json` file is also generated for reference and debugging purposes. |
| 78 | + |
| 79 | +The data structure contains: |
| 80 | + |
| 81 | +```json |
| 82 | +{ |
| 83 | + "products": { |
| 84 | + "rhel9": { |
| 85 | + "metadata": { /* Product metadata */ }, |
| 86 | + "controls": [ |
| 87 | + { |
| 88 | + "id": "ac-1", |
| 89 | + "title": "Access Control Policy and Procedures", |
| 90 | + "levels": ["low", "moderate", "high"], |
| 91 | + "rules": ["rule_id_1", "rule_id_2"], |
| 92 | + "status": "automated", |
| 93 | + "description": "OSCAL description...", |
| 94 | + "guidance": "OSCAL guidance...", |
| 95 | + "parameters": [ /* ODPs */ ], |
| 96 | + "related_controls": ["ac-2", "pm-9"], |
| 97 | + "has_rules": true, |
| 98 | + "is_automated": true |
| 99 | + } |
| 100 | + ] |
| 101 | + } |
| 102 | + }, |
| 103 | + "statistics": { |
| 104 | + "rhel9": { |
| 105 | + "total": 1196, |
| 106 | + "automated": 850, |
| 107 | + "manual": 50, |
| 108 | + "pending": 296, |
| 109 | + "with_rules": 900, |
| 110 | + "without_rules": 296 |
| 111 | + } |
| 112 | + }, |
| 113 | + "families": [ /* 21 control families */ ] |
| 114 | +} |
| 115 | +``` |
| 116 | + |
| 117 | +## Gap Analysis Features |
| 118 | + |
| 119 | +### Gap Identification |
| 120 | +Controls are marked as "gaps" when: |
| 121 | +- `status: pending` - No implementation exists |
| 122 | +- `has_rules: false` - No rules are mapped to the control |
| 123 | + |
| 124 | +### Gap Visualization |
| 125 | +- **Dashboard**: Red indicator showing total gaps with percentage |
| 126 | +- **Controls List**: Red dot indicator on gap controls |
| 127 | +- **Filter**: Dedicated "Without Rules" filter to show only gaps |
| 128 | +- **Gap List**: Top 20 gaps displayed on dashboard |
| 129 | + |
| 130 | +### Addressing Gaps |
| 131 | +1. Navigate to a gap control in the Controls view |
| 132 | +2. Add TODO items describing what needs to be implemented |
| 133 | +3. Create the necessary rules in the repository |
| 134 | +4. Regenerate the viewer to see updated statistics |
| 135 | + |
| 136 | +## TODO/Backlog Management |
| 137 | + |
| 138 | +### Adding TODOs |
| 139 | +1. Select a control |
| 140 | +2. Scroll to the "TODO / Backlog Items" section |
| 141 | +3. Type your TODO item |
| 142 | +4. Click "Add" |
| 143 | + |
| 144 | +### Managing TODOs |
| 145 | +- **Check**: Mark as complete |
| 146 | +- **Uncheck**: Mark as incomplete |
| 147 | +- **Delete**: Remove the item |
| 148 | + |
| 149 | +TODOs are stored in browser localStorage, so they persist across sessions but are local to your browser. |
| 150 | + |
| 151 | +## Customization |
| 152 | + |
| 153 | +### Modifying the Template |
| 154 | +Edit `utils/nist_sync/nist_viewer_template.html` to customize: |
| 155 | +- Styling (CSS in `<style>` section) |
| 156 | +- Layout (HTML structure) |
| 157 | +- Behavior (JavaScript functions) |
| 158 | + |
| 159 | +### Adding New Statistics |
| 160 | +Modify `generate_nist_viewer.py`: |
| 161 | +1. Update `generate_viewer_data()` to calculate new statistics |
| 162 | +2. Update the template to display them |
| 163 | + |
| 164 | +### Regenerate |
| 165 | +After making changes: |
| 166 | +```bash |
| 167 | +ninja nist-viewer |
| 168 | +``` |
| 169 | + |
| 170 | +## Workflow Integration |
| 171 | + |
| 172 | +The viewer is automatically built and published by `.github/workflows/gh-pages.yaml`: |
| 173 | + |
| 174 | +```yaml |
| 175 | +- name: Generate NIST 800-53 Control Viewer |
| 176 | + run: ninja nist-viewer |
| 177 | + working-directory: ./build |
| 178 | +``` |
| 179 | +
|
| 180 | +The generated files are copied to the GitHub Pages site by `utils/generate_html_pages.sh`. |
| 181 | + |
| 182 | +## Browser Compatibility |
| 183 | + |
| 184 | +The viewer uses modern JavaScript features and requires: |
| 185 | +- Chrome 90+ |
| 186 | +- Firefox 88+ |
| 187 | +- Safari 14+ |
| 188 | +- Edge 90+ |
| 189 | + |
| 190 | +No external dependencies - all functionality is self-contained in a single HTML file. |
| 191 | + |
| 192 | +## Troubleshooting |
| 193 | + |
| 194 | +### "Error loading data" |
| 195 | +- The data should be embedded in the HTML file - regenerate the viewer with `ninja nist-viewer` |
| 196 | +- If you modified the template, ensure the `/* DATA_PLACEHOLDER */` comment exists in the script section |
| 197 | +- Check browser console for specific error messages |
| 198 | +- The HTML file should be around 7MB - if it's much smaller, the data wasn't embedded properly |
| 199 | + |
| 200 | +### Controls not showing |
| 201 | +- Check filter settings - try resetting all filters |
| 202 | +- Verify the data file contains controls for the selected product |
| 203 | + |
| 204 | +### TODOs not persisting |
| 205 | +- localStorage must be enabled in your browser |
| 206 | +- Check browser privacy settings |
| 207 | +- TODOs are per-browser and per-domain |
| 208 | + |
| 209 | +### Dashboard not rendering |
| 210 | +- Check browser console for JavaScript errors |
| 211 | +- Ensure the JSON data loaded successfully |
| 212 | +- Try refreshing the page |
| 213 | + |
| 214 | +## Development |
| 215 | + |
| 216 | +To develop new features: |
| 217 | + |
| 218 | +1. Edit `nist_viewer_template.html` |
| 219 | +2. Test locally by opening the generated HTML file |
| 220 | +3. Regenerate after changes: `ninja nist-viewer` |
| 221 | +4. Commit both the template and updated CMake files |
| 222 | + |
| 223 | +## License |
| 224 | + |
| 225 | +Same license as the ComplianceAsCode/content project (BSD-3-Clause). |
0 commit comments