|
| 1 | +# Compliance Plugin |
| 2 | + |
| 3 | +Security compliance and vulnerability analysis tools for Go projects. |
| 4 | + |
| 5 | +## Command |
| 6 | + |
| 7 | +### `/compliance:analyze-cve <CVE-ID>` |
| 8 | + |
| 9 | +Analyzes Go codebases to determine CVE impact with multi-level confidence assessment. |
| 10 | + |
| 11 | +**Example:** |
| 12 | +``` |
| 13 | +/compliance:analyze-cve CVE-2024-24783 |
| 14 | +``` |
| 15 | + |
| 16 | +**Features:** |
| 17 | +- Fetches CVE details from NVD, MITRE, and Go Vulnerability Database |
| 18 | +- Multi-level verification (dependency check → static analysis → govulncheck → **call graph reachability**) |
| 19 | +- Generates reports with confidence levels (HIGH/MEDIUM/LOW) |
| 20 | +- Provides exact remediation commands |
| 21 | +- Optionally applies fixes with approval |
| 22 | + |
| 23 | +**Output:** |
| 24 | +- `.work/compliance/analyze-cve/{CVE-ID}/report.md` - Full analysis with confidence assessment |
| 25 | +- `.work/compliance/analyze-cve/{CVE-ID}/callgraph.svg` - Visual execution path (if call graph analysis performed) |
| 26 | +- `.work/compliance/analyze-cve/{CVE-ID}/govulncheck-output.txt` - Scanner results |
| 27 | + |
| 28 | +## Verification Levels |
| 29 | + |
| 30 | +The command uses multiple methods with increasing confidence: |
| 31 | + |
| 32 | +1. **Dependency check** → Confirms package presence |
| 33 | +2. **Static analysis** → Finds function usage |
| 34 | +3. **govulncheck** → Official Go vulnerability scanner |
| 35 | +4. **Call graph reachability** → Proves execution path (HIGHEST confidence) |
| 36 | +5. **Context analysis** → Checks security controls |
| 37 | + |
| 38 | +Reports include confidence level (HIGH/MEDIUM/LOW) based on verification methods used. |
| 39 | + |
| 40 | +## Prerequisites |
| 41 | + |
| 42 | +**Required:** Go toolchain |
| 43 | + |
| 44 | +**Recommended (for higher confidence):** |
| 45 | +```bash |
| 46 | +# Go vulnerability tools |
| 47 | +go install golang.org/x/vuln/cmd/govulncheck@latest |
| 48 | +go install golang.org/x/tools/cmd/callgraph@latest |
| 49 | +go install golang.org/x/tools/cmd/digraph@latest |
| 50 | + |
| 51 | +# Optional: For visual graphs |
| 52 | +brew install graphviz # macOS |
| 53 | +``` |
| 54 | + |
| 55 | +The command auto-detects available tools and uses the most comprehensive methods possible. |
| 56 | + |
| 57 | +## Fallback Mode |
| 58 | + |
| 59 | +If internet access fails, the command prompts for manual CVE information (description, affected packages, versions, fixes). Analysis proceeds with user-provided data, clearly marked in the report. |
| 60 | + |
| 61 | +## Report Includes |
| 62 | + |
| 63 | +- **Executive Summary**: Verdict (AFFECTED/NOT AFFECTED) with confidence level |
| 64 | +- **Analysis Methodology**: Which verification methods were used |
| 65 | +- **Impact Assessment**: Evidence from codebase, call chains (if found) |
| 66 | +- **Remediation Steps**: Exact commands and fixes |
| 67 | +- **Visual Artifacts**: Call graph SVG, scanner outputs |
| 68 | + |
| 69 | +## Examples |
| 70 | + |
| 71 | +### Basic usage |
| 72 | +``` |
| 73 | +/compliance:analyze-cve CVE-2024-24783 |
| 74 | +``` |
| 75 | +Analyzes codebase for crypto/x509 vulnerability, provides upgrade command if affected. |
| 76 | + |
| 77 | +### High-confidence analysis |
| 78 | +``` |
| 79 | +/compliance:analyze-cve CVE-2024-45338 |
| 80 | +``` |
| 81 | +**Result:** |
| 82 | +- Finds `golang.org/x/net/html v0.21.0` (vulnerable) |
| 83 | +- Proves execution path: `main → HTTPHandler → ParseHTML → html.Parse` |
| 84 | +- **Confidence**: HIGH | **Verdict**: AFFECTED |
| 85 | +- Generates `callgraph.svg` showing call chain |
| 86 | +- Recommends: `go get golang.org/x/[email protected]` |
0 commit comments