codebase-impact-analysis
БесплатноБез исполняемых скриптовНе проверенAnalyze a Go codebase to determine if it is impacted by a specific CVE using multiple verification methods and assign a risk level
от openshift-eng★ 123 звезды на GitHubОб этом скилле
Codebase Impact Analysis
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.
When to Use This Skill
Use this skill when:
- A CVE profile has been gathered (from the cve-intelligence-gathering skill)
- You need to determine if the current Go project is affected
- You need to assign a risk level with supporting evidence
Prerequisites
Required Tools (validated in Phase 0 of the analyze-cve skill)
gotoolchain withgo.modin 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@latest
Required Inputs
From Phase 1 (cve-intelligence-gathering skill):
- CVE ID
- Affected package/module name(s)
- Vulnerable version range
- Fixed version (if available)
- Vulnerable function signatures (if known)
From Parent Command:
--algopreference 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.
Implementation Steps
Step 1: Identify Go Module Dependencies
# Parse dependencies from go.mod
go list -m all
# Get detailed dependency info
go list -m -json all
- Read
go.modfrom workspace root - Parse direct and indirect dependencies
- Extract module versions
Step 2: Cross-Reference Vulnerable Packages
Apply the following methods in order. Each provides increasing confidence.
Method 1: Dependency Matching
- Compare CVE-affected packages with
go.moddependencies - Check if affected package versions are in use
- Account for version ranges and semantic versioning
# Check if vulnerable package is a dependency
go list -m <vulnerable-package>
Decision Point:
- IF package NOT in dependencies → Skip to risk assignment (likely LOW RISK)
- IF package found → Continue to Method 2
Method 2: Go Vulnerability Scanner
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"
- IF NOT FOUND → record "package not in module graph" as LOW signal; skip Steps 2b–2d entirely; proceed to Method 3
- IF FOUND → note the version; continue
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"
f
Установить codebase-impact-analysis в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл codebase-impact-analysis?
Analyze a Go codebase to determine if it is impacted by a specific CVE using multiple verification methods and assign a risk level
Как установить скилл codebase-impact-analysis?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл codebase-impact-analysis запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic