/compliance:call-graph-analysisfrom compliance
Performs definitive call graph analysis on Go codebases to prove whether vulnerable functions are reachable from program entry points. Useful for security audits, CVE triage, and compliance 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.
Provides highest-confidence vulnerability assessment by proving whether vulnerable functions can actually be reached during program execution.
Use this skill when:
govulncheck is unavailable or didn't find the CVEcallgraph: go install golang.org/x/tools/cmd/callgraph@latestdigraph: go install golang.org/x/tools/cmd/digraph@latestgo.mod filegraphviz (for visualization): brew install graphviz (macOS) or sudo apt-get install graphviz (Linux)sfdp or dot command (part of graphviz)<package-path>.<function-name>)vta) — passed via --algo from parent commandCVE_ID — used to construct the output directoryOUT_DIR (optional, default: ${AI_HELPERS_WORKSPACE:-.}/.work/compliance/analyze-cve/${CVE_ID}) — where artifacts are written; same workspace base as Phase 0.7's REPOS_BASE
- Always use
timeout -k 10— plaintimeoutsends SIGTERM butcallgraphcan ignore it when stuck in SSA construction or type resolution.-k 10sends SIGKILL after 10s grace, guaranteeing termination.- Never run
callgraphon./...for repos with more than ~50 packages. Target specific main packages (e.g../cmd/controller,./main.go) and let the tool pull in transitive deps automatically.- Always redirect output to a file (
> file 2>&1). Never pipe callgraph output to another command — if the reader closes, callgraph can hang on SIGPIPE.
--algo (default: vta).callgraph invocations use timeout -k 10 300 (5 minutes + 10s force-kill) to prevent hanging../cmd/controller), not ./.... The callgraph tool resolves transitive deps automatically — there is no need to include the entire repo.vta → rta → cha), then narrow scope further to a single binary entry point.# Check for callgraph
which callgraph || echo "callgraph not found - install with: go install golang.org/x/tools/cmd/callgraph@latest"
# Check for digraph
which digraph || echo "digraph not found - install with: go install golang.org/x/tools/cmd/digraph@latest"
# Optional: Check for graphviz
which sfdp || echo "graphviz not found - visual graphs won't be generated (optional)"
Decision Point:
First, discover the main packages that serve as entry points:
# Find main packages
MAIN_PKGS=$(find . -name "main.go" -exec dirname {} \; | sort -u)
echo "Main packages: ${MAIN_PKGS}"
Pick the most relevant main package for the analysis (typically the controller or server binary, not CLI tools or test helpers). If unsure, prefer the package that imports the vulnerable package's parent tree.
# Select exactly one TARGET_PKG before running callgraph
if [ -z "${TARGET_PKG:-}" ]; then
TARGET_PKG=$(printf '%s\n' ${MAIN_PKGS} | grep -E '(^|/)(cmd/)?(controller|manager|operator|server|main)(/|$)' | head -1)
[ -z "${TARGET_PKG}" ] && TARGET_PKG=$(printf '%s\n' ${MAIN_PKGS} | head -1)
fi
# Normalize to a package path callgraph accepts (./cmd/foo or .)
case "${TARGET_PKG}" in
.|./) TARGET_PKG="." ;;
*) TARGET_PKG="./${TARGET_PKG#./}" ;;
esac
if [ -z "${TARGET_PKG}" ] || [ "${TARGET_PKG}" = "./" ]; then
echo "ERROR: No main package found for call graph analysis"
exit 1
fi
echo "Selected TARGET_PKG=${TARGET_PKG}"
ALGO="${USER_ALGO:-vta}"
OUT_DIR="${OUT_DIR:-${AI_HELPERS_WORKSPACE:-.}/.work/compliance/analyze-cve/${CVE_ID}}"
mkdir -p "${OUT_DIR}"
# TARGET_PKG is the specific main package (e.g. ./cmd/controller, .)
# NEVER use ./... — it causes VTA to explode on large repos
echo "Building call graph: algo=${ALGO}, target=${TARGET_PKG}"
timeout -k 10 300 env CGO_ENABLED=0 callgraph -algo "${ALGO}" -format=digraph "${TARGET_PKG}" > "${OUT_DIR}/callgraph.txt" 2>&1
CG_EXIT=$?
echo "callgraph exit: ${CG_EXIT}, lines: $(wc -l < "${OUT_DIR}/callgraph.txt")"
Progressive fallback if the command times out or fails:
# Fallback 1: faster algorithm
if [ $CG_EXIT -eq 124 ] || [ $CG_EXIT -eq 137 ]; then
echo "⚠ ${ALGO} timed out — falling back to rta"
timeout -k 10 300 env CGO_ENABLED=0 callgraph -algo rta -format=digraph "${TARGET_PKG}" > "${OUT_DIR}/callgraph.txt" 2>&1
CG_EXIT=$?
fi
# Fallback 2: fastest algorithm
if [ $CG_EXIT -eq 124 ] || [ $CG_EXIT -eq 137 ]; then
echo "⚠ rta timed out — falling back to cha"
timeout -k 10 300 env CGO_ENABLED=0 callgraph -algo cha -format=digraph "${TARGET_PKG}" > "${OUT_DIR}/callgraph.txt" 2>&1
CG_EXIT=$?
fi
if [ $CG_EXIT -eq 124 ] || [ $CG_EXIT -eq 137 ]; then
echo "✗ All algorithms timed out — call graph analysis skipped"
fi
Error Handling:
vta → rta → cha, all on the same target packageOutput: ${OUT_DIR}/callgraph.txt containing the call graph rooted at the target binary
Extract the vulnerable function signature from CVE details.
# Search for exact function in the cached call graph
VULN_FUNC="<package-path>.<vulnerable-function>"
cat "${OUT_DIR}/callgraph.txt" | digraph nodes | grep "${VULN_FUNC}$"
Decision Point:
TARGET_PKG graph → Continue to Step 4MAIN_PKGS (different TARGET_PKG) before concludingSearch for paths from main entry points to the vulnerable function.
# Find path from main() to vulnerable function using cached call graph
ENTRY_POINT="command-line-arguments.main"
VULN_FUNC="<package-path>.<vulnerable-function>"
cat "${OUT_DIR}/callgraph.txt" | \
digraph somepath "${ENTRY_POINT}" "${VULN_FUNC}"
Alternative Entry Points to Check:
command-line-arguments.main (main program)*_test.go test functions*.initInterpretation:
Output: Text representation of call chain or empty result
If path exists, generate visual representation:
# Generate DOT format from cached call graph
cat "${OUT_DIR}/callgraph.txt" | \
digraph somepath "${ENTRY_POINT}" "${VULN_FUNC}" | \
digraph to dot > "${OUT_DIR}/callgraph.dot"
# Convert to SVG (if graphviz available)
if which sfdp > /dev/null; then
sfdp -Tsvg -o"${OUT_DIR}/callgraph.svg" -Goverlap=scale "${OUT_DIR}/callgraph.dot"
echo "Visual graph saved to: ${OUT_DIR}/callgraph.svg"
else
echo "Graphviz not available - DOT file saved to: ${OUT_DIR}/callgraph.dot"
fi
Output Files:
${OUT_DIR}/callgraph.dot - DOT notation of call path${OUT_DIR}/callgraph.svg - Visual graph (if graphviz available)Extract human-readable call chain from digraph output:
# Get call chain as text from cached call graph
cat "${OUT_DIR}/callgraph.txt" | \
digraph somepath "${ENTRY_POINT}" "${VULN_FUNC}" | \
digraph to dot | \
grep " -> " | \
sed 's/"//g' | \
sed 's/;//g'
Example Output:
command-line-arguments.main -> <package-path>.Handler
<package-path>.Handler -> <package-path>.ProcessFunction
<package-path>.ProcessFunction -> <vulnerable-package>.<vulnerable-function>
Format for Report:
Execution Path Found:
main → Handler → ProcessFunction → <vulnerable-function> (VULNERABLE)
HIGH RISK:
MEDIUM RISK:
LOW RISK:
Return structured result to parent analysis:
{
"method": "call-graph-reachability",
"algorithm": "vta",
"vulnerable_function": "<package-path>.<vulnerable-function>",
"found_in_graph": true,
"reachable_from_main": true,
"call_chain": "main → Handler → ProcessFunction → <vulnerable-function>",
"risk_level": "HIGH",
"evidence": {
"callgraph_file": "${OUT_DIR}/callgraph.txt",
"dot_file": "${OUT_DIR}/callgraph.dot",
"svg_file": "${OUT_DIR}/callgraph.svg"
}
}
vta → rta → cha)./... as scope — always target a specific main packagecommand-line-arguments.main not found → Look for other entry points# Setup
CVE_ID="CVE-YYYY-NNNNN"
OUT_DIR="${AI_HELPERS_WORKSPACE:-.}/.work/compliance/analyze-cve/${CVE_ID}"
mkdir -p "${OUT_DIR}"
# Step 1: Build call graph targeting a specific main package
timeout -k 10 300 env CGO_ENABLED=0 callgraph -algo vta -format=digraph ./cmd/controller > "${OUT_DIR}/callgraph.txt" 2>&1
# Step 2: Check if function is called
digraph nodes < "${OUT_DIR}/callgraph.txt" | grep "<package-path>.<vulnerable-function>$"
# Step 3: Find path from main
digraph somepath command-line-arguments.main "<package-path>.<vulnerable-function>" < "${OUT_DIR}/callgraph.txt"
# Step 4: Generate visual graph (if graphviz available)
digraph somepath command-line-arguments.main "<package-path>.<vulnerable-function>" < "${OUT_DIR}/callgraph.txt" | \
digraph to dot | sfdp -Tsvg -o"${OUT_DIR}/callgraph.svg"
# Result: HIGH RISK — reachable path found
This skill is called from Method 5 of the codebase-impact-analysis skill.
When to Invoke:
go.mod (see codebase-impact-analysis Method 5) — not just for "highest confidence"Return to Parent:
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
9 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.
/codebase-impact-analysisAnalyze a Go codebase to determine if it is impacted by a specific CVE using multiple verification methods and assign a risk level/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.npx claudepluginhub openshift-eng/ai-helpers --plugin complianceOther plugins' skills for the same job