Analyze Go codebase for CVE vulnerabilities and suggest fixes
Analyzes your Go codebase for a specific CVE vulnerability. It fetches vulnerability details, checks if your dependencies are affected, and provides remediation guidance. Use this when you need to assess security impact and get specific fix recommendations for a known CVE.
/plugin marketplace add openshift-eng/ai-helpers/plugin install compliance@ai-helpers<CVE-ID>compliance:analyze-cve
/compliance:analyze-cve <CVE-ID>
The compliance:analyze-cve command performs comprehensive security vulnerability analysis for Go projects. Given a CVE identifier, it fetches complete vulnerability details from authoritative sources, analyzes the codebase for potential impact, and provides actionable remediation guidance.
This command helps developers:
Validate CVE Format
Fetch CVE Details from Multiple Sources
Use web_search tool to gather information from these sources:
Primary Sources:
NVD: Search for "CVE-{ID} site:nvd.nist.gov"
MITRE: Search for "CVE-{ID} site:cve.mitre.org"
Go-Specific Sources:
Go Vulnerability Database: Search for "CVE-{ID} golang vulnerability"
GitHub Security Advisories: Search for "CVE-{ID} golang GHSA"
General Go Security:
Handle Search Issues and Limited Results
If CVE details cannot be fetched (network error, search failure, insufficient results):
If CVE is very new (e.g., CVE-2025-xxxxx):
If suggested fixes cannot be found:
Gather Remediation Intelligence
Compile Vulnerability Profile
Identify Go Module Dependencies
go.mod file from workspace rootgo list -m allCross-Reference Vulnerable Packages
Method 1: Dependency Matching
go.mod dependenciesMethod 2: Go Vulnerability Scanner
govulncheck if available in the environmentgovulncheck ./...go list -json -m all and cross-referenceMethod 3: Direct Dependency Check
go list to verify package presencego list -mod=mod <vulnerable-package>go list -mod=mod golang.org/x/net/htmlMethod 4: Call Graph Reachability Analysis (Highest Confidence)
callgraph tool# Check if vulnerable function exists in call graph
callgraph -format=digraph . | digraph nodes | grep "<vulnerable-function-signature>"
# Find execution path from main to vulnerable function
callgraph -format=digraph . | digraph somepath command-line-arguments.main <vulnerable-function> | digraph to dot
golang.org/x/net/html.Parse):
# Step 1: Check if Parse is called anywhere
callgraph -format=digraph . | digraph nodes | grep "golang.org/x/net/html.Parse$"
# Step 2: Find path from main() to Parse()
callgraph -format=digraph . | digraph somepath command-line-arguments.main golang.org/x/net/html.Parse
callgraph -format=digraph . | digraph somepath <entrypoint> <vulnerable-func> | digraph to dot | sfdp -Tsvg -o callgraph.svg
go install golang.org/x/tools/cmd/callgraph@latest
go install golang.org/x/tools/cmd/digraph@latest
Method 5: Source Code Analysis
Verify Impact with Multiple Methods & Confidence Levels
Use multiple verification layers, with each providing increasing confidence:
Level 1: Basic Presence (Low Confidence)
go.mod for vulnerable packagego list -mod=mod <vulnerable-package>Level 2: Import & Version Analysis (Medium Confidence)
Level 3: Vulnerability Scanner (Medium-High Confidence)
govulncheck ./... (official Go vulnerability checker)Level 4: Call Graph Reachability (Highest Confidence)
callgraph + digraph to prove execution path existsmain() (or test entry points) to vulnerable functionmain → MyHandler → ParseHTML → html.Parse (VULNERABLE)
Level 5: Configuration & Context Analysis
Recommended Approach: Use multiple methods and assign confidence:
Build Evidence Package
Collect comprehensive evidence for the report:
Dependency Evidence:
go.mod entries showing vulnerable packagego list output confirming presencego list -m <package>Static Code Evidence:
Reachability Evidence (if call graph analysis performed):
.work/compliance/analyze-cve/{CVE-ID}/callgraph.svg)Scanner Evidence:
govulncheck output (full text)Mitigation Factors:
Confidence Assessment:
Create Analysis Report
Location: .work/compliance/analyze-cve/{CVE-ID}/report.md
Additional artifacts:
callgraph.svg (if generated)govulncheck-output.txt (if run)evidence.json (structured evidence data)Include sections:
Executive Summary:
CVE Details:
Analysis Methodology:
✓ Method 1: Dependency check (go list) - POSITIVE
✓ Method 2: Version analysis - VULNERABLE VERSION FOUND
✓ Method 3: govulncheck scan - CVE REPORTED
✓ Method 4: Call graph analysis - REACHABLE PATH FOUND
→ Confidence: HIGH
Dependency Analysis:
Impact Assessment:
Risk Level:
Evidence:
Confidence Assessment:
Remediation Steps:
References:
Format Report
If Codebase is NOT Affected
If Codebase IS Affected
Update Dependencies
go get commands to upgrade packagesgo mod tidy after updatesCode Changes (if needed)
Workarounds (if no fix available)
Verification Commands
make verify, make build, make testmake -qp | grep "^[a-zA-Z]" | head -20Testing Recommendations
govulncheck to confirm vulnerability is resolvedPresent Remediation Plan
Ask User for Permission
If User Approves, Apply Fixes
Update go.mod and go.sum
go get -u <package>@<fixed-version>go mod tidy to clean upModify Source Code (if required)
Verify Changes
make verify first (if target exists)go mod verifymake build first (if target exists)go build ./...make test first (if target exists)go test ./...govulncheck ./... to confirm fixDocument Changes
.work/compliance/analyze-cve/{CVE-ID}/report.md/compliance:analyze-cve CVE-2024-45338
Analyzes the codebase for CVE-2024-45338<CVE-ID>: The CVE identifier to analyze (e.g., CVE-2024-1234, CVE-2023-45678)
govulncheck is not installed, the command will use alternative methodsRequired:
go version should work)go.mod and source files in the workspaceRecommended (for comprehensive analysis):
govulncheck - Go's official vulnerability checker
go install golang.org/x/vuln/cmd/govulncheck@latest
callgraph & digraph - For reachability analysis (highest confidence)
go install golang.org/x/tools/cmd/callgraph@latest
go install golang.org/x/tools/cmd/digraph@latest
sfdp or graphviz - For call graph visualization (optional)
# macOS
brew install graphviz
# Linux
sudo apt-get install graphviz
Alternative: If internet access is unavailable, be prepared to provide:
Tool Availability Check: The command will automatically detect which tools are available and use the most comprehensive methods possible. Missing tools will result in lower confidence levels but analysis will still proceed.