
golang
Go development tools: gopls MCP server, LSP integration, automatic gofmt formatting, golangci-lint linting, CVE dependency patching, Go stdlib CVE triage, and OCP and OKD release Go builder, module, and Dockerfile inventories
- version
- 0.7.0
- GitHub stars
- 123
Install
/plugin install golang@ai-helpersRun it inside Claude Code after adding the marketplace with /plugin marketplace add openshift-eng/ai-helpers.
Contents
Discovered from sourceSkills 6
Analyze release Go versions
Use only the scripts below to collect release data. Do not independently inspect registries, GitHub, repositories, Dockerfiles, go.mod files, or build configs. Your job is to interpret and filter script output for the user's question. If the user supplies output from these scripts, analyze that output directly.
Run from the repository root, replacing placeholders with the user's values:
python3 plugins/golang/scripts/release_go_builder_versions.py <release-image> --correlate-builder --build-root
python3 plugins/golang/scripts/release_go_builder_versions.py <release-image> --correlate-builder
python3 plugins/golang/scripts/release_go_builder_versions.py <release-image> --build-root
python3 plugins/golang/scripts/release_go_module_versions.py <release-image> <module>
python3 plugins/golang/scripts/release_go_module_versions.py <release-image> --go-version
<module> is the full Go module path the user is asking about (e.g. google.golang.org/protobuf, golang.org/x/net, k8s.io/client-go — any valid module works).
- Run only the needed script and mode.
--correlate-builderscans Dockerfiles or Containerfiles selected by release image build configs, including distinct OKD variants. Omit it only when the user wants all matching files in each source repository.--build-rootreports Go versions from each component's.ci-operator.yamlbuild root image tag (e.g.rhel-9-release-golang-1.26-openshift-5.0→1.26). This shows the CI build environment Go version, which may differ from the Dockerfile builder.- Combine both flags (
--correlate-builder --build-root) when the user asks about both Dockerfile builders and CI build roots. This avoids a redundant pass over the release — both lookups share the same source-repo resolution. The combined output appendsbuild root tagandbuild root go versioncolumns to each Dockerfile row. Prefer the combined form when both kinds of evidence are needed. - Used alone,
--build-rootproduces a compact 4-column output (component, repository, build root tag, go version) without Dockerfile scanning. - The builder script explicitly maps the two installer artifact components to build-data configs without
payload_name. Fornutanix-cluster-api-controllers, it scansopenshift/Dockerfile.openshiftin the source repository at the release-recorded ref when no build-data config matches; identify that row as source-repository evidence. - For a requested module, use its exact Go module path (e.g.
google.golang.org/grpc). Use--go-versiononly when the user asks aboutgodirectives ingo.mod. Run multiple scripts when the question needs both kinds of evidence. - Filter by component, repository, version, or variant as requested. Treat every returned row as separate evidence; the module script can return multiple rows per component and does not identify the
go.modpath in its output. - Preserve
(none), unknown values, and lookup errors as unknown or unavailable. Report module replacements as declared in script output, including local paths and fork modules. A builder tag such asgolang-1.26identifies the declared builder image version; agodirective or module declaration does not prove which compiler built the final image or which module version its binary contains. - Report the filtered results and any material coverage gaps. Do not fill gaps by fetching data yourself.
fix-cve
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.
Parameters
- module (required): The Go module to patch, e.g.
google.golang.org/grpc - fix-version (required): The upstream version that contains the CVE fix, e.g.
v1.75.1— or a URL to the release/advisory with version info - cve (required): The CVE identifier, e.g.
CVE-2026-33186 - ticket (required): The Jira/bug ticket, e.g.
OCPBUGS-83972
If any required parameter is missing, ask the user before proceeding.
Strategy selection
The fix follows one of three paths depending on Go version compatibility. Determine which path to take BEFORE making any changes.
Gather version info
- Read the project's Go version from the root
go.mod(godirective), e.g.go 1.23.6 - Determine the Go version required by the CVE fix. Either:
- Fetch the upstream fix version's
go.modto check itsgodirective - Parse it from the release page or advisory the user provided
- Fetch the upstream fix version's
- Extract the major.minor from both (e.g.
1.23fromgo 1.23.6)
Path A: Direct upstream update (project Go >= fix Go)
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).
Path B: Bump Go patch version (same minor, lower patch)
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.
Path C: Use openshift-sustaining fork (project Go minor < fix Go minor)
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:
- STOP and ask the user for the replacement module URL. Suggest checking
https://github.com/openshift-sustaining/<module-name>/releasesfor available patched versions matching the project's Go minor. - Once the user provides the fork URL/version, fetch its
go.modto verify its Go version is compatible. - Add a
replacedirective in each affectedgo.modpointing to the fork. - Follow the standard update workflow (Step 3 onwards).
The replace directive format:
// <CVE number>
replace <original-module> => <fork-module> <fork-version>
Standard update workflow
Once the strategy is determined and the go.mod changes are made, follow these steps in exact order.
Step 1: Find all affected go.mod files
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.
Step 2: Sync vendor for each affected module (CRITICAL)
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.
Step 3: Handle macOS toolchain issues
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.
Step 4: Run repo checks
Inspect the Makefile for update and verify targets:
grep -E "^(update|verify):" Makefile
Run in order:
make update
make verify
If either fails:
- Verify Step 2 completed for ALL affected modules
- Verify Go version / toolchain is correct
- Check for stale binaries in
hack/tools/bin/— delete and rebuild - Read the error — don't retry blindly. STOP and report to the user.
After success, verify changes:
git diff --stat
Step 5: Commit
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:
- Path A:
update - Path B:
bump go version and update - Path C:
replace
Use git commit -s for sign-off if required.
Step 6: Optionally create a PR
Before any push or PR action:
- Ask the user for explicit permission to push and open the PR.
- Confirm the current branch is not
mainormaster. - Never use force push flags (
-f,--force,--force-with-lease). - Discover remotes via
git remote -v; do not assume names likeorigin.
Format for OpenShift:
[<branch>] <TICKET>: fix <CVE> by <action> <module-name>
Include in the PR body:
- CVE ID and description
- Link to Jira ticket
- Link to advisory (GHSA)
- Link to the fix (upstream commit or fork release)
Hard stops — when to STOP and ask
- Path C triggered: The project's Go minor is lower than the fix requires. Ask the user for the openshift-sustaining fork URL.
- Go directive bumped after tidy: A transitive dependency forced a Go version change.
make updateormake verifyfail: Report the error, don't retry blindly.
Troubleshooting
"Hit an unsupported type invalid type" from codegen
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 macOS
Use GOTOOLCHAIN=go1.23.6 to compile with a newer Go. Delete stale hack/tools/bin/* first.
go work sync bumps workspace modules
Expected when using Go workspaces. The bumps in api/go.mod etc. are normal.
vendor/modules.txt mismatch
Run go mod vendor again for the affected module.
Examples
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.
Go Lint Fix
Run golangci-lint and fix all reported issues, using auto-fix first then AI for the rest.
Discovery
This skill always calls golangci-lint directly (required for --fix). Discovery finds any project-specific flags, config, or plugins to carry into those calls.
- CLAUDE.md / AGENTS.md: Check for linting instructions. Note any flags, config paths, or constraints documented there.
- Makefile targets: Check for
lintorverify-linttargets (grep -E "^(lint|verify-lint):" Makefile). Inspect the target body to extract flags such as--config,--timeout,--build-tags, or module plugin references. - Fallback: Use
golangci-lint run ./...with no extra flags.
Collect all discovered flags into a $FLAGS variable used throughout the Fix Process.
If golangci-lint Is Not Found
Report that golangci-lint is not available and direct the user to the installation docs. Do not auto-install.
Fix Process
- Baseline: Run
golangci-lint run $FLAGS ./...and record the issue count. - Auto-fix: Run
golangci-lint run --fix $FLAGS ./...to resolve all automatically fixable issues. - Re-check: Run
golangci-lint run $FLAGS ./...again to see remaining issues. - AI fixes: For each remaining issue, fix it directly in the source file.
- Verify: Re-run
golangci-lint run $FLAGS ./...after each batch of AI fixes. - Loop: Repeat steps 4–5 until the output is clean or no further progress is made.
Guidelines
- Prefer real fixes over
//nolintdirectives. Use//nolintonly as a last resort with a comment explaining why. - Generated files: Do not modify files with a
// Code generatedheader. Add//nolintat the call site or exclude the file in.golangci.ymlinstead. - Constants: Before adding a new constant to fix a magic-number lint error, check whether an equivalent constant already exists in the package or its imports.
Go Lint
Run golangci-lint to check Go code quality and report issues.
Discovery
Find how to run the linter using this cascade — stop at the first match:
- CLAUDE.md / AGENTS.md: Check for instructions about linting. If a lint command is documented, use it.
- Makefile targets: Check for
lintorverify-linttargets (grep -E "^(lint|verify-lint):" Makefile). If found, runmake lintormake verify-lint. - Direct invocation: Run
golangci-lint run ./...
If golangci-lint Is Not Found
Report that golangci-lint is not available and direct the user to the installation docs. Do not auto-install.
Output
Use this format when issues are found:
Found 15 issues:
- goconst: 5 issues
- staticcheck: 4 issues
- gocyclo: 3 issues
- revive: 3 issues
Example issues:
- pkg/api/handler.go:42: string "application/json" has 3 occurrences (goconst)
- pkg/utils/helper.go:87: cyclomatic complexity 15 of function ProcessData (gocyclo)
When clean:
Code passes all linter checks (0 issues found)
Constraint
This skill is read-only. Never modify files or attempt fixes. Use the golang:lint-fix skill for that.
If the user passes additional flags, chain them to the golangci-lint invocation (e.g., --tests, --concurrency 4).
Native FIPS
Configure a Go project to use Go's native FIPS 140 module (GOFIPS140). With CGO_ENABLED=0, this produces static binaries that no longer depend on the openssl RPM. Projects that require cgo should keep CGO_ENABLED=1 and adjust their FIPS setup accordingly. Works for both new projects and migrating existing openssl-based FIPS setups.
Reference
Build-time: GOFIPS140
Tells the Go compiler which FIPS 140 crypto module to embed into the binary.
| Value | Status | ML-KEM | ML-DSA | Notes |
|---|---|---|---|---|
v1.0.0 | Validation completed | Yes | No | Validated, stable |
v1.26.0 | Module In Process (MIP) | Yes | Yes | Adds ML-DSA + better entropy |
latest | Alias | — | — | Resolves to newest available module |
certified | Alias | — | — | Resolves to newest FIPS-certified module |
Use certified in go build as it automatically resolves to the latest certified module (currently v1.0.0). Both modules support ML-KEM (post-quantum key encapsulation), so post-quantum key exchange is available without the old DEFAULT:PQ crypto-policies stage.
Build-time: GOEXPERIMENT=strictfipsruntime (downstream only)
The downstream golang-fips/go toolchain (used in RHEL/CentOS Go Toolset) provides GOEXPERIMENT=strictfipsruntime, which adds a startup check that panics if the binary's FIPS configuration is incompatible with the host environment. This is separate from GOFIPS140 — it provides fail-closed startup enforcement, not module selection.
When migrating a downstream build from the OpenSSL backend to native FIPS on 1.26+ builders, retain GOEXPERIMENT=strictfipsruntime and add -tags no_openssl to disable the OpenSSL backend. The 1.26+ builders imply GODEBUG=fips140=auto whenever the FIPS module is compiled in, so the binary works on both FIPS and non-FIPS hosts:
CGO_ENABLED=0 GOFIPS140=v1.26.0 GOEXPERIMENT=strictfipsruntime go build -tags no_openssl ...
For upstream Go (which has no strictfipsruntime or OpenSSL backend):
CGO_ENABLED=0 GOFIPS140=certified go build ...
Runtime: GODEBUG=fips140=<value>
Controls FIPS activation at runtime. You almost never need to set this explicitly. When a binary is built with GOFIPS140, the toolchain sets an appropriate default: upstream Go defaults to fips140=on, and the downstream golang-fips/go toolchain defaults (or will soon default) to fips140=auto. Only override this if you need behavior different from the toolchain default.
| Value | Behavior | Availability |
|---|---|---|
fips140=auto | Follow the host's FIPS setting (/proc/sys/crypto/fips_enabled) | Downstream golang-fips/go only |
fips140=on | Always enable FIPS, regardless of host | Upstream Go and downstream |
fips140=only | Best-effort FIPS-only mode — non-FIPS crypto calls may return an error or panic. May produce false positives/negatives. Test and assessment only — not for production. | Upstream Go and downstream |
Upstream Go (go.dev) supports off, on, and only. The auto value is provided by the downstream golang-fips/go toolchain.
Post-quantum cryptography (ML-KEM)
Go 1.24+ includes crypto/mlkem (FIPS 203) and crypto/tls uses X25519MLKEM768 by default for TLS connections. This means ML-KEM is built into the binary — no OS-level crypto-policies configuration is needed.
The old approach required a separate crypto-policies setup (via RPM or manual config) to enable DEFAULT:PQ. This configured system C libraries (OpenSSL, GnuTLS, NSS, etc.) by generating per-library config files in /etc/crypto-policies/back-ends/:
| Backend file | Library |
|---|---|
openssl.config / opensslcnf.config | OpenSSL |
gnutls.config | GnuTLS |
nss.config | NSS (Mozilla) |
openssh.config / opensshserver.config | OpenSSH |
java.config | Java/OpenJDK |
krb5.config | Kerberos |
libssh.config | libssh |
The :PQ subpolicy prepends hybrid ML-KEM groups at highest priority, adding X25519MLKEM768, P256-MLKEM768, P384-MLKEM1024 etc. to each backend in its native syntax.
Why this is unnecessary for Go binaries: A statically-compiled Go binary (CGO_ENABLED=0) with GOFIPS140 uses its own crypto/tls stack — it does not link against OpenSSL, GnuTLS, or NSS. OS-level crypto-policies back-end configs have zero effect on Go binaries. Such binaries have no runtime library dependencies, so they can run in minimal scratch-like images such as Hardened Images - Static.
Verification with tls-scanner
The tls-scanner tool can verify endpoint TLS compliance on a running cluster — it connects to pod endpoints and checks their TLS configuration (protocol versions, cipher suites, and with PQC_CHECK=true, TLS 1.3 and ML-KEM readiness). It does not verify binary-level FIPS properties such as GOFIPS140 module embedding, runtime FIPS activation, or non-TLS cryptographic usage.
The tool source and documentation is at https://github.com/openshift/tls-scanner. The tls-scanner-run step ref is defined in the openshift/release step registry at ci-operator/step-registry/tls/scanner/run/.
Parameters
| Parameter | Default | Description |
|---|---|---|
SCAN_NAMESPACE | "" (all) | Comma-separated namespaces to scan. Empty scans all namespaces. |
PQC_CHECK | "false" | Set "true" to check post-quantum cryptography readiness (TLS 1.3 + ML-KEM support). |
SCANNER_NAMESPACE | "" | Namespace where the scanner pod is deployed. Empty creates a dedicated tls-scanner namespace. |
SCAN_LIMIT_IPS | "" | Max IPs to scan (empty/0 = no limit). Useful for smoke testing. |
TLS_PROFILE_TYPE | "" | Expected TLS profile type (Old, Intermediate, Modern). When set, overrides reading from APIServer/cluster. |
TLS_SCANNER_CLUSTER_LABEL | "" | HyperShift target: "management" or "guest". Empty scans via the step's KUBECONFIG. |
Glossary
| Name | Type | Values | Description |
|---|---|---|---|
GOFIPS140 | Build env var | certified, latest, v1.0.0, v1.26.0 | Selects which FIPS 140 crypto module to embed. certified resolves to the latest validated module. |
GOEXPERIMENT=strictfipsruntime | Build env var | (flag) | Downstream only. Adds a startup panic if FIPS config is incompatible with the host. |
CGO_ENABLED | Build env var | 0, 1 | 0 produces a static binary with no C dependencies. 1 links against C libraries (needed if the project requires cgo). |
-tags no_openssl | Build tag | (flag) | Disables the downstream OpenSSL crypto backend so the binary uses only Go's native FIPS module. Not needed for upstream Go. |
fips140v1.26 | Synthesized build tag | (automatic) | Injected by the toolchain when GOFIPS140=v1.26.0 is set. Not user-specified. |
GODEBUG=fips140 | Runtime env var | auto, on, only, off | Controls FIPS activation at runtime. Rarely needs to be set — the toolchain picks the right default when built with GOFIPS140. auto is downstream only. |
triage-fixed-cves
Analyze an OpenShift release image to determine which Go standard library CVE Jira tickets have been addressed by the Go version used to build each component. Produces a per-CVE, per-component cross-reference report.
The user provides a release image pullspec (e.g.
quay.io/openshift-release-dev/ocp-release:4.17.0-x86_64).
Execute every step below in order. Do not skip steps.
Step 1 — Extract component images from the release
oc adm release info <RELEASE_IMAGE> --output=json
Parse the JSON output to get the list of component image references. Each
entry in .references.spec.tags[] provides a name (component name) and
.from.name (image pullspec).
Each tag also carries .annotations metadata. Extract the
io.openshift.build.source-location annotation — this is the canonical
source GitHub repository URL for that component (e.g.
https://github.com/openshift/cluster-version-operator). Also extract
io.openshift.build.commit.id which gives the exact source commit SHA
the image was built from. Record both for every component — they are used
in Steps 2 and 4.
Auth failure: If oc adm release info fails due to an authentication
error, STOP immediately. Report the auth failure to the user and do not
proceed. Do not attempt to locate pull secrets, probe environment variables,
or try alternative credential paths — the RWS pod's registry proxy handles
authentication transparently, so an auth failure means the proxy does not
have credentials for this registry and manual intervention is required.
Collect the full list of (component_name, image_pullspec, source_repo, source_commit) tuples before proceeding.
Step 2 — Identify the built binary per component via Dockerfile
For each component, identify exactly which binary is built and where it lands in the final image by looking up the component's Dockerfile. Do NOT scan the entire image for all ELF binaries.
CI images (most components)
Look up the ci-operator config at
github.com/openshift/release/ci-operator/config/openshift/<repo>/.
Match the correct config file for the release branch and build variant (e.g.
openshift-cluster-version-operator-release-4.17.yaml). The config's
images.items[] specifies the dockerfile_path for each image. Fetch that
Dockerfile from the component's own repository at the exact source commit
recorded in io.openshift.build.commit.id from Step 1 — do not use
tree/main or the branch tip, as the release image may have been built from
an older revision.
Builder substitutions: ci-operator configs may declare builder image
overrides via images.items[].inputs.as — these replace FROM targets in
the Dockerfile at build time, which can change the Go toolchain version used.
Note any such substitutions when recording the component's build context.
Release / nightly images
Check the ocp-build-data config on the matching branch (e.g.
github.com/openshift-eng/ocp-build-data/tree/openshift-4.17/images/<component>.yml).
The from: and dockerfile: fields point to the Dockerfile.
OKD builds: The ocp-build-data image config may contain an
okd_alignment section that specifies a different Dockerfile for OKD
builds. These are typically named Dockerfile.scos or Dockerfile.okd.
When this section is present, use the OKD-specific Dockerfile instead of
the default one for OKD images. As with CI images, fetch the OKD
Dockerfile at the exact source commit from io.openshift.build.commit.id
(Step 1), not from the branch tip.
Parse the Dockerfile
Look for:
go build -o <binary>orgo installcommands — these tell you the output binary name.COPY --from=builder <src> <dest>in multi-stage builds — this tells you where the binary is placed in the final image.
Example: a Dockerfile with go build -o /go/bin/cvo ./cmd/cvo and
COPY --from=builder /go/bin/cvo /usr/bin/cluster-version-operator means
the target binary is /usr/bin/cluster-version-operator.
Step 3 — Detect Go version per component
For each component, extract the Go version from the specific binary identified in Step 2.
podman pull <IMAGE>
podman create --name tmp-extract <IMAGE>
podman cp tmp-extract:<binary_path> /tmp/target-binary
podman rm -f tmp-extract # always remove so the name is freed for the next component
go version /tmp/target-binary
Cleanup: Always run podman rm -f tmp-extract unconditionally after
extraction (even on failure) so the container name is available for the
next component. Wrap the extract-copy-remove sequence in a function or
loop body to ensure cleanup is never skipped.
Parse the output. The format is:
/tmp/target-binary: go1.22.5
Extract the semver-style version (e.g. 1.22.5).
Important caveats
- Do NOT assume a single Go version across the release. Different
components may use different Go toolchain versions. ci-operator builder
image substitutions (
images.items[].inputs.as) mean components can lag behind or jump ahead of the "default" Go version for a release. - Inspect ONLY the specific binary identified from the Dockerfile. Do not scan the entire image filesystem for ELF binaries — that is slow, wasteful, and may pick up unrelated binaries from base images.
- If a component's Dockerfile cannot be found, or the component is not built
from Go (e.g. a pure shell image or non-Go component), record it as
N/A — no Go binary foundand skip it in later steps. - If the Dockerfile builds multiple Go binaries, checking any one of them is sufficient — all binaries in the same image share the same builder image and therefore the same Go toolchain version.
- Process components in batches to avoid excessive pull traffic. 10–20 at a time is reasonable.
Step 4 — Query Jira for open Go stdlib CVE trackers
Search for open Jira vulnerability issues that track Go standard library CVEs affecting the components in this release.
4a — Map release components to Jira components
Using the io.openshift.build.source-location source repo URLs extracted in
Step 1, map each repo to its corresponding OCPBUGS Jira component name (e.g.
openshift/cluster-version-operator → cluster-version-operator).
4b — Query for open stdlib CVE trackers
Using the discovered component list, query Jira with the coordinator's
query_jira tool:
project = OCPBUGS
AND type = Vulnerability
AND labels in ("arc:stdlib")
AND status not in (Closed, "Release Pending", Verified)
AND component in (<discovered components>)
AND summary ~ "openshift-<version>"
ORDER BY component ASC
Replace <discovered components> with the comma-separated list of Jira
component names from step 4a, and <version> with the target OCP version
(e.g. 4.17).
For each returned issue, record:
- Jira issue key (e.g.
OCPBUGS-12345) - CVE ID (e.g.
CVE-2024-24790) — extract theCVE-YYYY-NNNNNpattern from the issue summary - Summary text
- Affected component(s) listed in Jira
- Fix version if mentioned in the issue
Step 5 — Exclude vendored dependency CVEs
Filter out CVEs that affect vendored Go dependencies rather than the Go standard library itself. The goal is to keep only CVEs that are fixed by upgrading the Go toolchain version.
Exclusion rules
-
golang.org/x/*packages: CVEs affectinggolang.org/x/net,golang.org/x/crypto,golang.org/x/text,golang.org/x/image, etc. are vendored dependencies, not stdlib. Exclude them. -
Hybrid CVEs: Some CVEs affect both stdlib packages AND vendored modules (e.g. a CVE that affects
net/httpin stdlib but alsogolang.org/x/net/http2). Classify these into a separate "Hybrid" category — do not list them as both included and excluded:- The stdlib portion IS fixed by a Go version upgrade — include this in the per-CVE cross-reference (Steps 6–7).
- The vendored portion requires a separate dependency bump — note this in the hybrid section of the report.
-
Detection method: Read the Jira issue description and any linked advisories. Look for:
- Package paths starting with
golang.org/x/— vendored - Package paths like
net/http,crypto/tls,os,runtime— stdlib - References to the Go vulnerability database entry
- Package paths starting with
Produce three lists from this step:
- Stdlib-only CVEs → proceed to Steps 6–7 cross-reference
- Hybrid CVEs → proceed to Steps 6–7 cross-reference (stdlib portion) AND note in the dedicated hybrid section of the report (Step 7.4)
- Vendored-only CVEs → excluded; listed in the report (Step 7.5)
Step 6 — Map CVEs to Go vulnerability DB and cross-reference
For each remaining stdlib CVE, determine which Go versions contain the fix, then check each component against those fix versions.
6a — Extract GO-* ID from Jira remote links
ProdSec and ARC typically attach a pkg.go.dev/vuln/GO-* URL to Go CVE
tracker tickets as a web link (remote link). The coordinator's
get_jira_issue tool returns remote links in its output.
For each CVE's Jira issue:
- Call
get_jira_issue(issue_key)(you already have the issue key from Step 4). - Look through the remote links / web links section of the response for a URL
matching
pkg.go.dev/vuln/GO-*(e.g.https://pkg.go.dev/vuln/GO-2024-2887). - Extract the
GO-YYYY-NNNNID from that URL.
This is more reliable than searching the vuln database by CVE text, because
the Go vulnerability database uses GO-* format IDs (not CVE IDs directly)
and text search can miss or return ambiguous results.
6b — Fetch fixed versions
Using the GO-* ID, fetch the vulnerability entry:
https://pkg.go.dev/vuln/<GO_ID>
Use web_fetch to retrieve the page content, or fetch the JSON:
curl -s "https://vuln.go.dev/ID/<GO_ID>.json"
The vulnerability entry contains fixed version fields under each affected
module/package. For stdlib entries the module is stdlib (or std). The
fixed field tells you the first Go version where the vulnerability is
patched (e.g. 1.22.5).
Note: there may be multiple fix versions for different Go release branches
(e.g. fixed in 1.21.12 and 1.22.5). Record all of them.
Fallback if no remote link is present: If a Jira ticket does not have a
pkg.go.dev/vuln remote link, try searching the Go vulnerability database
web interface via web_fetch:
https://pkg.go.dev/vuln/list?q=<CVE_ID>
If no Go vulnerability database entry exists for a CVE, note it as "not in Go vuln DB."
6c — Cross-reference: which components are fixed?
For each CVE, compare the fixed Go version(s) against each component's detected Go version from Step 3.
For a given CVE with fixed versions [1.21.12, 1.22.5]:
- A component built with Go
1.22.5or later on the 1.22 branch → FIXED - A component built with Go
1.22.4on the 1.22 branch → AFFECTED - A component built with Go
1.21.12or later on the 1.21 branch → FIXED - A component built with Go
1.23.0(a newer minor branch) → FIXED (Go includes all prior fixes in new minor releases)
Version comparison rules:
- Compare within the same minor release branch first (1.22.x vs 1.22.y).
- A component on a newer minor branch (e.g. 1.23.x) than any listed fix version is considered fixed.
- A component on an older minor branch that has no fix listed for that branch is AFFECTED unless explicitly listed as unaffected in the vuln DB entry.
Build a matrix: CVE × Component → FIXED | AFFECTED | N/A.
Step 7 — Generate the report
Produce a structured Markdown report with the following sections:
7.1 — Summary of Go versions across the release
- Table of all unique Go versions found, with a count of components using each.
- Flag any outlier versions (components using a significantly older Go version than the majority).
7.2 — Per-CVE breakdown
For each CVE (sorted by CVE ID):
- CVE ID and Jira issue key (linked)
- Summary (one-line description)
- Fixed in Go versions: list all fix versions from the vuln DB
- Affected components: list components whose Go version is older than the fix
- Fixed components: count of components already on a fixed Go version
- Status:
ALL FIXED|PARTIALLY FIXED (N of M)|ALL AFFECTED
7.3 — Outlier components
List components whose Go version is notably older than the release majority. These are the highest-risk components for stdlib CVEs and likely need builder image updates.
7.4 — Hybrid CVEs
List CVEs classified as hybrid in Step 5. For each, show:
- The stdlib packages affected (fixed by the Go version upgrade) and their cross-reference status from section 7.2.
- The vendored packages affected (require a separate dependency bump) and which components still carry the vulnerable vendored version.
This section prevents hybrid CVEs from being ambiguously double-listed as both "included" and "excluded."
7.5 — Excluded CVEs
List CVEs excluded in Step 5 as vendored-only, with the reason for
exclusion (e.g. golang.org/x/net — vendored dependency, not stdlib).
Store the report
Write the report to a file and store it via store_text with a descriptive
label (e.g. golang-cve-triage-4.17.0) so the coordinator can share it with
the user.
store_text(
local_path="/workspace/golang-cve-report.md",
label="golang-cve-triage-<version>",
description="Go stdlib CVE triage report for OCP <version>"
)
Hooks 1
MCP servers 1
Sponsors
Details
- Marketplace
- openshift-eng/ai-helpers
- Source
- plugins/golang
- Category
- Development
- Keywords
- go, gopls, lsp, linting, formatting
More from openshift-eng/ai-helpers
All 56- gopls-lspv1.0.0
- gwapiv0.0.1
- hcpv0.0.3
- hello-worldv1.0.3
- jirav0.9.8
- lvmsv0.1.1
- marketplace-opsv0.1.2
- metricsv0.3.0
- must-gatherv0.0.3
- native-notificationsv0.0.2
- nid-teamv0.2.2
- nodev0.0.3
- node-bugv0.0.3
- node-cvev0.0.8
- node-onboardingv0.0.3
- node-rpmv0.0.3
- node-teamv1.0.1
- node-tuningv1.0.1
- olmv0.1.3
- olm-teamv0.2.1
- openshiftv0.0.8
- openshift-developerv1.1.42
- openshift-tls-profilev0.0.2
- operator-dashboardv0.0.1