/compliance:codebase-impact-analysisfrom compliance
Determines if a Go codebase is impacted by a specific CVE using dependency matching, govulncheck, and call graph analysis, then assigns a risk level with evidence.
Ships in compliance. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Determines whether a Go codebase is impacted by a specific CVE by applying multiple analysis methods with increasing confidence, collecting evidence, and assigning a risk level.
Use this skill when:
go toolchain with go.mod in workspace rootgovulncheck: go install golang.org/x/vuln/cmd/govulncheck@latestcallgraph: go install golang.org/x/tools/cmd/callgraph@latestdigraph: go install golang.org/x/tools/cmd/digraph@latestFrom Phase 1 (cve-intelligence-gathering skill):
From Parent Command:
--algo preference for call graph analysis (default: vta)REPO_DIR — the repository cloned in Phase 0.7 (e.g. .work/compliance/analyze-cve/repos/hypershift). All commands below run against this directory, not necessarily the shell's current working directory.# Parse dependencies from go.mod
go list -m all
# Get detailed dependency info
go list -m -json all
go.mod from workspace rootApply the following methods in order. Each provides increasing confidence.
go.mod dependencies# Check if vulnerable package is a dependency
go list -m <vulnerable-package>
Decision Point:
CRITICAL RULES — read before running anything:
- Run govulncheck AT MOST ONCE per analysis run. Keep all Method 2 scratch and cache files under
${OUT_DIR}/(same per-CVE workspace as call-graph artifacts). The canonical result is${OUT_DIR}/govulncheck-source.txt— if it already exists and is non-empty for this run, read it and do not re-run.- Never pipe govulncheck to
head,tail,grep, or any other command. Always redirect to a file (> file 2>&1). Piping causes govulncheck to hang (SIGPIPE) when the reader closes.- "No findings" is a valid and final result — it means the CVE is not yet in the Go vuln database. Proceed to Method 3 immediately. Do NOT re-run in a different mode or format.
- Always use
timeout -k 10to force-kill if SIGTERM is ignored. Plaintimeoutsends SIGTERM but govulncheck can ignore it when stuck in package loading.
This method has 4 sequential steps. If any step fails or times out, skip the remaining steps and proceed to Method 3 — govulncheck is one signal, not the only one.
OUT_DIR="${OUT_DIR:-${AI_HELPERS_WORKSPACE:-.}/.work/compliance/analyze-cve/${CVE_ID}}"
mkdir -p "${OUT_DIR}"
Step 2a — go.mod check (instant)
VULN_PKG="google.golang.org/grpc" # replace with actual vulnerable package
echo "=== Step 2a: go.mod check for ${VULN_PKG} ==="
grep "${VULN_PKG}" "${REPO_DIR}/go.mod" && echo "FOUND in go.mod" || echo "NOT FOUND in go.mod"
Step 2b — Pre-flight: download modules and verify toolchain (max 2 min)
Large repos (300+ deps like spiffe-spire) need all modules cached before govulncheck can load them. Separate this from the scan to isolate network issues from analysis hangs.
cd "${REPO_DIR}"
echo "=== Step 2b: Pre-flight ==="
# Download all modules (network-bound, do first)
echo "Downloading modules..."
timeout -k 10 120 env CGO_ENABLED=0 go mod download > "${OUT_DIR}/go-mod-download.txt" 2>&1
if [ $? -ne 0 ]; then
echo "⚠ go mod download failed or timed out — govulncheck may fail"
cat "${OUT_DIR}/go-mod-download.txt"
fi
# Verify the Go toolchain can load the package graph (CGO disabled first — many repos fail only with CGO enabled)
echo "Loading package list (CGO_ENABLED=0)..."
timeout -k 10 60 env CGO_ENABLED=0 go list ./... > "${OUT_DIR}/go-list-packages.txt" 2>&1
LIST_EXIT=$?
PKG_COUNT=$(wc -l < "${OUT_DIR}/go-list-packages.txt" 2>/dev/null || echo 0)
echo "Package count: ${PKG_COUNT}, exit code: ${LIST_EXIT}"
if [ $LIST_EXIT -ne 0 ]; then
echo "go list with CGO_ENABLED=0 failed — retrying after CGO probe (Step 2c) before skipping govulncheck"
fi
go list succeeds with CGO_ENABLED=0 → continue to Step 2c, then 2dgo list still fails after Step 2c's CGO probe (with the chosen CGO_SETTING) → write the error to ${OUT_DIR}/govulncheck-source.txt, skip Steps 2c–2d, proceed to Method 3Step 2c — CGO probe (max 60s, skip if compiler absent)
echo "=== Step 2c: CGO probe ==="
CGO_SETTING=0
if command -v gcc >/dev/null 2>&1 || command -v cc >/dev/null 2>&1; then
timeout -k 10 60 env CGO_ENABLED=1 go build ./... > "${OUT_DIR}/cgo-probe.txt" 2>&1
if [ $? -eq 0 ]; then
CGO_SETTING=1
echo "✓ CGO works — using CGO_ENABLED=1"
else
echo "✗ CGO build failed — using CGO_ENABLED=0"
fi
else
echo "✗ No C compiler — using CGO_ENABLED=0"
fi
echo "CGO_ENABLED=${CGO_SETTING}"
if [ $LIST_EXIT -ne 0 ]; then
echo "Retrying go list with CGO_ENABLED=${CGO_SETTING}..."
timeout -k 10 60 env CGO_ENABLED=${CGO_SETTING} go list ./... > "${OUT_DIR}/go-list-packages.txt" 2>&1
LIST_EXIT=$?
PKG_COUNT=$(wc -l < "${OUT_DIR}/go-list-packages.txt" 2>/dev/null || echo 0)
echo "Retry package count: ${PKG_COUNT}, exit code: ${LIST_EXIT}"
if [ $LIST_EXIT -ne 0 ]; then
echo "✗ go list failed after CGO probe — skipping govulncheck entirely"
echo "go list failed (exit ${LIST_EXIT})" > "${OUT_DIR}/govulncheck-source.txt"
cat "${OUT_DIR}/go-list-packages.txt" >> "${OUT_DIR}/govulncheck-source.txt"
fi
fi
go list still fails after retry → ${OUT_DIR}/govulncheck-source.txt is populated; skip Step 2d and proceed to Method 3go list succeeds → continueStep 2d — govulncheck scan (max 5 min)
Use -scan=package first (fast, checks if CVE is in vuln DB and package imported). Only escalate to symbol-level if package-level finds something.
if [ ! -s "${OUT_DIR}/govulncheck-source.txt" ] && [ $LIST_EXIT -eq 0 ]; then
# Package-level scan first (fast — no symbol resolution)
echo "=== Step 2d: govulncheck package scan ==="
timeout -k 10 120 env CGO_ENABLED=${CGO_SETTING} govulncheck -scan=package ./... > "${OUT_DIR}/govulncheck-package.txt" 2>&1
PKG_EXIT=$?
echo "govulncheck -scan=package exit: ${PKG_EXIT}"
cat "${OUT_DIR}/govulncheck-package.txt"
# Check if the package scan found anything worth escalating to symbol level
if grep -qi "Vulnerability\|finding\|${VULN_PKG}" "${OUT_DIR}/govulncheck-package.txt" 2>/dev/null; then
echo "=== Step 2d: govulncheck symbol scan (escalating — CVE found at package level) ==="
timeout -k 10 300 env CGO_ENABLED=${CGO_SETTING} govulncheck ./... > "${OUT_DIR}/govulncheck-source.txt" 2>&1
SOURCE_EXIT=$?
if [ $SOURCE_EXIT -eq 124 ] || [ $SOURCE_EXIT -eq 137 ]; then
echo "govulncheck symbol scan timed out or was killed — using package-level results"
cp "${OUT_DIR}/govulncheck-package.txt" "${OUT_DIR}/govulncheck-source.txt"
fi
else
echo "Package scan found no findings — CVE likely not in Go vuln DB yet"
cp "${OUT_DIR}/govulncheck-package.txt" "${OUT_DIR}/govulncheck-source.txt"
fi
echo "govulncheck complete"
else
echo "=== govulncheck (using cached result) ==="
fi
cat "${OUT_DIR}/govulncheck-source.txt"
# Verify repo is still accessible after govulncheck
echo "=== Post-govulncheck repo check ==="
ls "${REPO_DIR}/go.mod" > /dev/null 2>&1 && echo "✓ Repo intact at ${REPO_DIR}" || echo "✗ WARNING: Repo missing at ${REPO_DIR}"
${OUT_DIR}/govulncheck-source.txt as a workflow artifactDecision Point — govulncheck is ONE signal. Always continue to Method 3 next.
# Verify package is included (directly or transitively)
go list -mod=mod <vulnerable-package>
Note: Package presence alone doesn't prove vulnerable functions are called.
Delegate to the call-graph-analysis skill.
--algo preference from user, vulnerable function signature, package pathScope rule: Never invoke
callgraphwith./.... Always target a specific main package (e.g../cmd/controller,.). The tool resolves transitive dependencies automatically. Running on./...causes VTA to exhaust resources on repos with >50 packages (external-secrets has 138, spiffe-spire has 300+). See the call-graph-analysis skill for the progressive fallback chain (vta→rta→cha).
This method is REQUIRED whenever the vulnerable package is present in go.mod — regardless of what Methods 2, 3, or 4 found. Source code analysis (Method 4) is heuristic: it can miss indirect calls through interfaces, generated code, and runtime dispatch. Only a call graph provides provable reachability.
Valid reasons to skip call graph:
go.mod (genuinely unreachable — LOW RISK by definition)NOT a valid reason to skip:
Each method provides increasing confidence:
go.mod (Method 1, 3)govulncheck confirms reachable vulnerable symbols (Method 2)Required minimum: If the package is in go.mod, the analysis is not complete until Method 5 has run or a valid skip reason has been documented. Never stop at Method 4 alone.
Collect evidence from all methods used:
go.mod entries, go list output, version info${AI_HELPERS_WORKSPACE:-.}/.work/compliance/analyze-cve/{CVE-ID}/callgraph.svg, outside REPO_DIR)govulncheck output, vulnerability findingsEvaluate all evidence and assign a risk level. The determination should be data-driven, not formula-based.
HIGH RISK:
govulncheck confirms called vulnerable symbols (package-level import alone is not sufficient)MEDIUM RISK:
LOW RISK:
NEEDS REVIEW:
go.mod but call graph was skipped for any reason other than package absence or build failure — escalate; do not leave as LOW based on source code analysis aloneRule: If package is in
go.modand call graph was skipped because source analysis "found nothing", assign NEEDS REVIEW, not LOW RISK. Document the skip reason explicitly.
Return structured result to parent command:
{
"skill": "codebase-impact-analysis",
"status": "success",
"risk_level": "<HIGH|MEDIUM|LOW|NEEDS_REVIEW>",
"methods_used": ["dependency_matching", "govulncheck", "direct_dependency_check", "source_code_analysis", "call_graph", "context_analysis"],
"evidence": {
"dependency": {
"package_found": true,
"current_version": "<version>",
"dependency_type": "<direct|indirect>",
"in_vulnerable_range": true
},
"govulncheck": {
"ran": true,
"cve_found": true,
"vulnerable_symbols_called": true
},
"call_graph": {
"ran": true,
"algorithm": "<vta|rta|cha|static>",
"reachable_from_main": true,
"call_chain": "main -> handler -> parse -> VULN",
"evidence_files": ["callgraph.dot", "callgraph.svg"],
"skip_reason": "<null if ran | 'package_not_in_gomod' | 'build_failure' | 'unknown_function_signature'>"
},
"source_analysis": {
"import_found": true,
"function_usage_found": true,
"files": ["<file1>:<line>", "<file2>:<line>"]
},
"mitigation_factors": []
},
"confidence_assessment": {
"level": "<HIGH|MEDIUM|LOW>",
"methods_count": 4,
"gaps": ["<any gaps in analysis>"]
}
}
vta → rta → cha), always targeting a specific main package. Never use ./... as scope.skip_reason: unknown_function_signature, assign MEDIUM at best — do NOT assign LOW based on source analysis aloneThis skill is called from Phase 2 of the analyze-cve skill, after the Repo Guard has confirmed REPO_DIR still exists.
Input: CVE profile from Phase 1, --algo preference from user, REPO_DIR set in Phase 0.7
Output: Risk level, evidence package, confidence assessment
Next: The analyze-cve skill uses risk level to decide whether to generate report and proceed to remediation
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub openshift-eng/ai-helpers --plugin compliance9 skills in this plugin
/analyze-cveFull Go CVE analysis workflow. Given a CVE identifier -- supplied directly, or
resolved from a Jira ticket or JQL batch -- resolves and clones the affected
repository, gathers vulnerability intelligence, analyzes codebase impact with
govulncheck and call-graph reachability, generates a risk report, and optionally
applies a fix and opens a GitHub pull request.
Use when the user gives a CVE ID (CVE-YYYY-NNNNN), a Jira ticket (--jira=), or a
JQL query (--jql=) for Go CVE triage; wants call-graph proof that a vulnerable
function is reachable; or wants an automated fix and PR for a Go dependency
vulnerability.
Triggers on: 'analyze CVE', 'CVE impact', 'is this repo affected by CVE',
'Go vulnerability analysis', 'triage this Jira CVE ticket', 'fix this CVE and
open a PR', or a bare CVE-YYYY-NNNNN identifier.
/call-graph-analysisPerform definitive call graph analysis to prove whether vulnerable functions are reachable from program entry points/create-fix-prUse when opening or updating a GitHub pull request after Phase 5 of `/compliance:analyze-cve` has applied and verified a CVE fix locally./cve-intelligence-gatheringGather comprehensive vulnerability information from multiple authoritative sources with fallback strategies/image-repo-mappingUse when resolving which GitHub repository to clone for CVE analysis from a container image name in a Jira ticket summary, pscomponent label, or Downstream Component Name field./jira-cve-extractionUse when `/compliance:analyze-cve` is invoked with `--jira=` or `--jql=` and needs the CVE ID, image name, branch, and enriched ticket context from a Jira issue.Other plugins' skills for the same job