go-vuln-remediate
Scans Go services in konk for CVEs and generates automated dependency patches. Simplifies vulnerability remediation and build validation.
Install
mkdir -p .claude/skills/go-vuln-remediate && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/13392" && unzip -o skill.zip -d .claude/skills/go-vuln-remediate && rm skill.zipInstalls to .claude/skills/go-vuln-remediate
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Run Wiz-based vulnerability scan and automatic Go module remediation for containerized Go services in the konk repository. Use when you need to build images, scan CVEs, patch vulnerable dependencies in go.mod/go.sum across konk-service and konk-provision modules, validate builds, and prepare a PR summary.Key capabilities
- →Build Go binaries and Docker images for scanning
- →Run Wiz scanner against built images
- →Apply allowlisted dependency updates per Go module
- →Rebuild to validate no regressions
- →Produce PR-ready markdown summaries
How it works
The skill builds Go binaries and Docker images, scans them with Wiz, parses the output, recommends fixes, applies allowlisted updates, rebuilds for validation, and generates PR summaries.
Inputs & outputs
When to use go-vuln-remediate
- →Build konk Go images
- →Scan container vulnerabilities
- →Patch Go module CVEs
- →Generate PR summaries for security fixes
About this skill
Go Wiz Auto Vulnerability Fix (konk)
Purpose
This skill converts the GitHub Actions workflow behavior into an agent-driven runbook for local or CI-assisted execution. It helps you:
- Build Go binaries and Docker images for scan.
- Run Wiz scanner against the built images.
- Parse Wiz output into structured findings.
- Recommend the safest compatible fix version for each package.
- Score exploit urgency versus fix risk and allowlist low-risk fixes.
- Apply only allowlisted dependency updates, per Go module.
- Rebuild to validate no regressions.
- Produce PR-ready markdown summaries for fixes, skipped items, and manual follow-ups.
Repository Layout (multi-module)
konk has no root go.mod. Each scanned image is built from its own Go module:
| Target | Module dir | Dockerfile | Image tag |
|---|---|---|---|
konk-service | cmd/konk-service | Dockerfile.konk-service | konk-service |
konk-provision | cmd/provision | Dockerfile.provision | konk-provision |
Out of scope for auto-fix (must be remediated manually):
- The konk operator image (root
Dockerfile) buildsoperator-sdkhelm-operatorfrom upstream source — CVEs require bumping the pinnedoperator-sdktag in the Dockerfile. - The konk-app image (
build/kubernetes/Dockerfile) is a patched kube-apiserver fork — CVEs require bumpingK8S_RELEASEin the Makefile.
When to Use
Use this skill when one or more konk Go services have vulnerability findings and you want repeatable, semi-automated remediation with guardrails.
Required Inputs
Collect these before execution:
- Service config values (all sourced from
.github/skills/go-vuln-remediate/konk/service-config.env):IMAGE_NAME,DOCKERFILE_PATH,SERVER_BUILD_PATH— defaults that describe the first targetSCAN_TARGETS—;-separated list of images to build and scan; each entry isname|dockerfile|build_path|image_tag|module_dir. konk scans two images (konk-service,konk-provision); findings from all images are merged before risk scoring, and the resulting allowlist is applied per-module.BUILD_TAGS,BUILD_LDFLAGS,DOCKER_BUILD_EXTRA_ARGSBASE_IMAGEGO_PRIVATEMODE— risk scoring mode (heuristic only)RISK_THRESHOLD_AUTO— score below this can be auto-appliedRISK_THRESHOLD_REVIEW— score below this requires review instead of skipMIN_CONFIDENCE— minimum confidence required forauto_applyEXPLOIT_WEIGHT— weight for severity/exploit scoreVERSION_WEIGHT— weight for version safety scoreCYCLE_WEIGHT— weight for urgency / time-to-fix score- The bundled
konk/service-config.envis a template with repo-specific defaults. Copy it locally or override values in your environment before running the skill outside CI.
- Credentials/tokens (if scanning private images or repos):
- Wiz client id/secret (
WIZ_CLIENT_ID/WIZ_CLIENT_SECRET) - Registry username/password (
HARBOR_SERVICES_PROD_USERNAME/HARBOR_SERVICES_PROD_PASSWORD) - Git token with private module access (
GITPAT)
- Wiz client id/secret (
Use workflow mapping as the canonical behavior reference.
Procedure
-
Ensure you are at the root of the repo. konk has no root
go.mod; each module lives undercmd/<target>/. -
Build Docker image(s) for scanning. Iterate every entry in
SCAN_TARGETSand build each image as<image_tag>:scan:bash -lc 'set -euo pipefail; source .github/skills/go-vuln-remediate/konk/service-config.env; IFS=";" read -r -a TARGETS <<< "$SCAN_TARGETS"; for e in "${TARGETS[@]}"; do IFS="|" read -r n d b img m <<< "$e"; echo "Building $img:scan from $d"; docker build --progress=plain -f "$d" --build-arg BASE_IMAGE="$BASE_IMAGE" $DOCKER_BUILD_EXTRA_ARGS -t "$img:scan" .; done'- Note: wrapping in
bash -lcprevents zsh strict-mode/RPROMPT hook errors whenDOCKER_BUILD_EXTRA_ARGScontains multiple--build-argflags.
-
Select scanner and scan each target image — choose the first available path:
- Wiz (primary, workflow parity) — if
WIZ_CLIENT_IDandWIZ_CLIENT_SECRETare both set:- Install
wizcli(workflow behavior):curl -sL --fail -o wizcli "https://downloads.wiz.io/v1/wizcli/${WIZ_CLI_VERSION}/wizcli-linux-amd64" && chmod +x wizcli && sudo mv wizcli /usr/local/bin/wizcli
- Install
- Authenticate:
wizcli auth --id "$WIZ_CLIENT_ID" --secret "$WIZ_CLIENT_SECRET" - Scan each target to a per-image JSON file
wiz-scan-results-<name>.json:wizcli docker scan -i "<image_tag>:scan" -p "PSE: Vulnerability - Critical - Audit/Warn - All Projects" -p "PSE: Vulnerability - High - Audit/Warn - All Projects" --json-output-file "wiz-scan-results-<name>.json" --file-hashes-scan- Parse all JSON files together with Wiz JSON parser (it accepts multiple inputs and unions findings):
.github/skills/go-vuln-remediate/scripts/wiz-json-parse.sh wiz-scan-results-*.json --parsed parsed-vulns.txt --cve-map cve-map.txt --cve-version-map cve-version-map.txt.
- Parse all JSON files together with Wiz JSON parser (it accepts multiple inputs and unions findings):
- Grype (fallback) — if Wiz credentials are absent or Wiz scan cannot run, and
command -v grypesucceeds:- Run grype parser per image and merge outputs.
- No scanner available — if no valid scanner path above can run:
- Print:
"No scanner available: wizcli is not installed or Wiz credentials are missing, and grype is not installed. Stopping."and exit.
- Print:
- Wiz (primary, workflow parity) — if
-
Recommend the safest compatible fix version for each package:
bash .github/skills/go-vuln-remediate/scripts/version-selector.sh parsed-vulns.txt version-recommendations.jsonl
-
Score exploit urgency versus time-to-fix and build the auto-apply allowlist:
bash -lc 'set -euo pipefail; source .github/skills/go-vuln-remediate/konk/service-config.env; bash .github/skills/go-vuln-remediate/scripts/risk-score.sh --input parsed-vulns.txt --recommendations version-recommendations.jsonl --output risk-decisions.jsonl --mode "$MODE" --auto-threshold "$RISK_THRESHOLD_AUTO" --review-threshold "$RISK_THRESHOLD_REVIEW" --min-confidence "$MIN_CONFIDENCE" --confidence "$CONFIDENCE" --exploit-weight "$EXPLOIT_WEIGHT" --version-weight "$VERSION_WEIGHT" --cycle-weight "$CYCLE_WEIGHT"'jq -r 'select(.decision=="auto_apply") | "\(.package)\t\(.fixed_version)"' risk-decisions.jsonl > allowlist.txt
-
Apply only allowlisted fixes per module. The shared allowlist is replayed against every module that has the affected package as a direct or indirect requirement:
WORK="$PWD"- For each
SCAN_TARGETSentry, capturemodule_dir, then run inside that directory with absolute artifact paths:cd "$module_dir" && "${WORK}/.github/skills/go-vuln-remediate/scripts/parse-fix.sh" --mode apply --parsed "${WORK}/parsed-vulns.txt" --recommendations "${WORK}/version-recommendations.jsonl" --allowlist "${WORK}/allowlist.txt" --summary "${WORK}/vuln-fix-summary-<name>.md"
- Concatenate per-module summaries into
vuln-fix-summary.md, prefixing each section with a### Module: <module_dir>heading.
-
If fixes were applied, run build validation per module using the same flags:
cd "$module_dir" && CGO_ENABLED=0 go build -v -tags "$BUILD_TAGS" -trimpath -ldflags "$BUILD_LDFLAGS" -o "${WORK}/bin/<name>" "$build_path"
-
Generate final artifacts for review. If fixes were applied, commit the changed
go.modandgo.sumfiles in each affected module dir on a new branch and open a PR:vuln-fix-summary.mdparsed-vulns.txtcve-map.txtcve-version-map.txtversion-recommendations.jsonlrisk-decisions.jsonlallowlist.txt- updated
cmd/konk-service/go.mod,cmd/konk-service/go.sum,cmd/provision/go.mod,cmd/provision/go.sumwhen successful
Note: konk modules do not commit
vendor/.parse-fix.shwill rungo mod tidy && go mod vendorlocally as a validation step but onlygo.modandgo.sumare committed to the PR.
Guardrails Included
- Skips dependency updates with large minor-version jumps (>10).
- Captures packages with no available fixed version (including EOL-TECHNOLOGY findings).
- Preserves full package names (including names with spaces) during parse and summary generation using tab-delimited records.
- Distinguishes stdlib findings from module findings.
- Reverts
go.modandgo.sumifgo mod downloadfails for a package. - Reverts all dependency changes (in the current module dir) if
go mod tidyorgo mod vendorfails. - Includes findings requiring manual remediation regardless of domain suffix pattern.
- Detects transitive dependencies via
go mod graph; transitive packages requiring manual remediation report their importing repos. - Tracks CVEs per package and per fixed version (
cve-map.txt,cve-version-map.txt). - When multiple fix versions are suggested for a package: all are shown in the summary for visibility, but only the recommended allowlisted target is actually applied.
- Uses risk scoring to separate
auto_apply,review_required, andskip_autocandidates before any dependency change. - Scanner selection: workflow parity installs
wizcliat runtime when Wiz credentials are present, then scans/parses JSON output. Grype is used as fallback when Wiz cannot run andgrypeis installed; if neither path is available execution stops with an error message. All scanner paths produce identicalparsed-vulns.txt/cve-map.txt/cve-version-map.txtoutput, and downstream recommendation/risk/apply steps are unchanged. - Multi-module safety: the shared allowlist is applied independently inside each module's directory; modules that don't require an affected package are left untouched by
parse-fix.sh's direct/indirect detection.
Output Contract
The skill writes:
vuln-fix-summary.md— combined markdown summary, with per-module sections containing:- Packages Updated — pipe-delimited table (
| Package | From | To | Severity | CVEs |); ro
- Packages Updated — pipe-delimited table (
Content truncated.
When not to use it
- →When remediating vulnerabilities in the konk operator image
- →When remediating vulnerabilities in the konk-app image
- →When the project is not a containerized Go service in the konk repository
Prerequisites
Limitations
- →The konk operator image is out of scope for auto-fix.
- →The konk-app image is out of scope for auto-fix.
- →The skill is specific to the konk repository's multi-module layout.
How it compares
This skill automates the vulnerability scanning and remediation process for Go modules in the konk repository, including building, scanning, patching, and PR summary generation, unlike a manual, multi-step security workflow.
Compared to similar skills
go-vuln-remediate side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| go-vuln-remediate (this skill) | 0 | 1mo | Caution | Advanced |
| dependency-auditor | 1 | 9mo | Review | Beginner |
| security-automation | 1 | 7mo | Review | Advanced |
| sca-setup | 0 | 4mo | No flags | Beginner |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
dependency-auditor
alirezarezvani
Check dependencies for known vulnerabilities using npm audit, pip-audit, etc. Use when package.json or requirements.txt changes, or before deployments. Alerts on vulnerable dependencies. Triggers on dependency file changes, deployment prep, security mentions.
security-automation
Ed1s0nZ
安全自动化的专业技能和方法论
sca-setup
robertsinfosec
SCA scanning setup workflow. Use when adding software composition analysis to a repository, configuring Dependabot, setting up npm audit in CI, or when a repo is missing dependency vulnerability scanning. Produces working Dependabot config and CI checks.
repo-security-posture
superagent-ai
Audit a GitHub repository's security posture and hardening gaps across branch protection, CODEOWNERS, GitHub Actions, publish/release integrity, collaborator access, security features, and dependency review. Use when reviewing or hardening a repo, assessing GitHub configuration, checking CI/CD or Ac
upgrade-deps
obot-platform
Upgrade dependencies and runtimes safely, run CI, and report higher-risk options.
ship-safe
kinncj
Run ship-safe security and quality audit on the current project. Executes npx ship-safe audit . and reports findings by severity. Use before shipping any feature or PR.