plugins/golang/skills/fix-cve/SKILL.md
Patch a Go dependency to fix a CVE using the appropriate strategy based on Go version compatibility. Use when the user wants to fix a CVE by updating a Go module, replacing it with a patched fork, or applying a security patch across all go.mod files in a Go project. Triggers on: 'patch CVE', 'fix CVE', 'replace grpc', 'update vulnerable dependency', 'security patch go module', or any mention of CVE + Go dependency replacement.
npx skillsauth add openshift-eng/ai-helpers fix-cveInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Patch a Go module dependency to fix a CVE. The skill determines the right strategy based on Go version compatibility between the project and the fix, then applies the minimum changes needed.
google.golang.org/grpcv1.75.1 — or a URL to the release/advisory with version infoCVE-2026-33186OCPBUGS-83972If any required parameter is missing, ask the user before proceeding.
The fix follows one of three paths depending on Go version compatibility. Determine which path to take BEFORE making any changes.
go.mod (go directive), e.g. go 1.23.6go.mod to check its go directive1.23 from go 1.23.6)Condition: The project's Go version is equal or higher than what the fix requires. The fix can be applied by simply updating the dependency to the upstream version that contains the patch.
Example: Project uses go 1.25.0, fix requires go 1.23.1 → direct update works.
Action: Update the module version in go.mod to the fix version (or latest patched version), then follow the standard update workflow (Step 3 onwards).
Condition: The project's Go is on the same minor version as the fix but a lower patch. Bumping the patch version (Z in X.Y.Z) within go.mod is safe enough to unlock the fix.
Example: Project uses go 1.23.1, fix requires go 1.23.7 → bump to go 1.23.7 in go.mod and update the dependency.
Action: Update the go directive in go.mod to the required patch version, then update the module and follow the standard update workflow. Report the Go patch bump to the user but don't block on it.
Condition: The project's Go minor version is lower than what the upstream fix requires. Bumping Go minor on a release branch is not acceptable — we need a backported patch.
Example: Project uses go 1.22.1, upstream fix requires go 1.23.0 → need a fork.
The openshift-sustaining team maintains patched forks of common libraries at lower Go versions for exactly this case. These live under https://github.com/openshift-sustaining/ and follow a naming pattern like v1.71.3-sec.1 (component version + security patch suffix).
Action:
https://github.com/openshift-sustaining/<module-name>/releases for available patched versions matching the project's Go minor.go.mod to verify its Go version is compatible.replace directive in each affected go.mod pointing to the fork.The replace directive format:
// <CVE number>
replace <original-module> => <fork-module> <fork-version>
Once the strategy is determined and the go.mod changes are made, follow these steps in exact order.
find . -name "go.mod" -not -path "*/vendor/*"
For each go.mod, check if it references the target module:
grep "<module>" path/to/go.mod
Report which are affected. Only modify affected ones. Apply the same change (version bump or replace directive) to each.
This is the most important step. The vendor directory MUST be updated BEFORE running any repo-level checks like make update. Without this, codegen tools that use go/packages with -mod=vendor fail with cryptic errors like Hit an unsupported type invalid type because the new module code isn't in vendor yet.
For each affected go.mod, from its directory:
GO111MODULE=on GOWORK=off GOFLAGS="" go mod tidy
GO111MODULE=on GOWORK=off GOFLAGS="" go mod vendor
GOWORK=off prevents Go workspace interference. GOFLAGS="" prevents inheriting -mod=vendor which blocks downloads.
go mod tidy may bump transitive dependencies — this is expected (MVS).
After tidy, verify the go directive in each go.mod was NOT bumped. If it was, STOP and tell the user — a transitive dependency is forcing a Go version bump.
If the project's Go version is old enough to have dyld issues on modern macOS (typically Go < 1.22.5 on macOS Sequoia/Tahoe), use GOTOOLCHAIN to compile with a newer Go while preserving module semantics:
GOTOOLCHAIN=go1.23.6 make update
This compiles using Go 1.23.6 but respects the go 1.22.x directive in the module. Delete stale binaries in hack/tools/bin/ before running if switching toolchain versions.
Inspect the Makefile for update and verify targets:
grep -E "^(update|verify):" Makefile
Run in order:
make update
make verify
If either fails:
hack/tools/bin/ — delete and rebuildAfter success, verify changes:
git diff --stat
fix(deps): <action> <module-name> to fix <CVE>
<TICKET>
<Description of what was done and why.>
<One-line description of the vulnerability.>
Where <action> is:
updatebump go version and updatereplaceUse git commit -s for sign-off if required.
Before any push or PR action:
main or master.-f, --force, --force-with-lease).git remote -v; do not assume names like origin.Format for OpenShift:
[<branch>] <TICKET>: fix <CVE> by <action> <module-name>
Include in the PR body:
make update or make verify fail: Report the error, don't retry blindly.The vendor doesn't have the new module code. Ensure go mod tidy && go mod vendor ran for the root module BEFORE make update.
dyld: missing LC_UUID on macOSUse GOTOOLCHAIN=go1.23.6 to compile with a newer Go. Delete stale hack/tools/bin/* first.
go work sync bumps workspace modulesExpected when using Go workspaces. The bumps in api/go.mod etc. are normal.
Run go mod vendor again for the affected module.
Path A — direct update (project Go 1.25.0, fix needs Go 1.23):
/golang:fix-cve module="google.golang.org/grpc" fix-version="v1.75.1" cve="CVE-2026-33186" ticket="OCPBUGS-83972"
Path C — fork replace (project Go 1.22.1, fix needs Go 1.23):
/golang:fix-cve module="google.golang.org/grpc" fix-version="v1.75.1" cve="CVE-2026-33186" ticket="OCPBUGS-83972"
→ Skill detects Go mismatch, asks user for fork, user provides github.com/openshift-sustaining/grpc-go v1.71.3-sec.1, skill applies replace directive.
research
Shared engine for analyzing Jira issue activity and generating status summaries
testing
Snapshot OpenShift payload data (release controller, PR diffs, comments, CI jobs, JUnit results, regression tracking) to a local directory for offline analysis
development
Analyze a payload snapshot to identify root causes of blocking job failures, score candidate PRs, and produce an HTML report with revert recommendations
tools
Create TRT JIRA bugs, open revert PRs, and trigger payload jobs for high-confidence revert candidates