Skip to content

Commit 6e6bd56

Browse files
committed
Add compliance plugin with CVE analysis command
Signed-off-by: chiragkyal <[email protected]>
1 parent 98fa13e commit 6e6bd56

File tree

6 files changed

+650
-1
lines changed

6 files changed

+650
-1
lines changed

.claude-plugin/marketplace.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@
6868
"name": "must-gather",
6969
"source": "./plugins/must-gather",
7070
"description": "A plugin to analyze and report on must-gather data"
71+
},
72+
{
73+
"name": "compliance",
74+
"source": "./plugins/compliance",
75+
"description": "Security compliance and vulnerability analysis tools for Go projects"
7176
}
7277
]
73-
}
78+
}

PLUGINS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ This document lists all available Claude Code plugins and their commands in the
44

55
- [Agendas](#agendas-plugin)
66
- [Ci](#ci-plugin)
7+
- [Compliance](#compliance-plugin)
78
- [Doc](#doc-plugin)
89
- [Git](#git-plugin)
910
- [Hello World](#hello-world-plugin)
@@ -38,6 +39,15 @@ Miscellaenous tools for working with OpenShift CI
3839

3940
See [plugins/ci/README.md](plugins/ci/README.md) for detailed documentation.
4041

42+
### Compliance Plugin
43+
44+
Security compliance and vulnerability analysis tools for Go projects
45+
46+
**Commands:**
47+
- **`/compliance:analyze-cve` `<CVE-ID>`** - Analyze Go codebase for CVE vulnerabilities and suggest fixes
48+
49+
See [plugins/compliance/README.md](plugins/compliance/README.md) for detailed documentation.
50+
4151
### Doc Plugin
4252

4353
A plugin for engineering documentation and notes

docs/data.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,21 @@
391391
}
392392
],
393393
"has_readme": true
394+
},
395+
{
396+
"name": "compliance",
397+
"description": "Security compliance and vulnerability analysis tools for Go projects",
398+
"version": "0.0.1",
399+
"commands": [
400+
{
401+
"name": "analyze-cve",
402+
"description": "Analyze Go codebase for CVE vulnerabilities and suggest fixes",
403+
"synopsis": "/compliance:analyze-cve <CVE-ID>",
404+
"argument_hint": "<CVE-ID>"
405+
}
406+
],
407+
"skills": [],
408+
"has_readme": true
394409
}
395410
]
396411
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "compliance",
3+
"description": "Security compliance and vulnerability analysis tools for Go projects",
4+
"version": "0.0.1",
5+
"author": {
6+
"name": "chiragkyal"
7+
}
8+
}

plugins/compliance/README.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
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

Comments
 (0)