Skip to content

Add fix-cve skill to golang plugin for Go CVE patching - #470

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift-eng:mainfrom
jparrill:patch-cve
May 20, 2026
Merged

openshift-merge-bot[bot] merged 1 commit into
openshift-eng:mainfrom
jparrill:patch-cve

Conversation

@jparrill

@jparrill jparrill commented May 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds the /golang:fix-cve skill that automates patching Go module dependencies to fix CVEs
  • Supports three strategies based on Go version compatibility: direct upstream update (Path A), Go patch version bump (Path B), and openshift-sustaining fork replacement (Path C)
  • Handles multi-module repos, vendor syncing, macOS toolchain issues, and standardized commit/PR creation
  • Consolidated as a single skill (no separate command) per project conventions

Background

This skill was born from hands-on CVE patching work on the hypershift repo:

  1. Manual work:
  1. Refined approach:
  1. Automated with the skill:

Test plan

  • Run make lint — passes clean (0 errors, 0 warnings)
  • Run make update — PLUGINS.md and docs/data.json regenerated correctly
  • Verify /golang:fix-cve appears in the skill list after plugin installation
  • Test the command against a Go repo with a known CVE dependency

🤖 Generated with Claude Code

@openshift-ci
openshift-ci Bot requested review from bryan-cox and rvanderp3 May 14, 2026 13:16
@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 14, 2026
@coderabbitai

coderabbitai Bot commented May 14, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

This PR adds a complete /golang:fix-cve command and skill, updates plugin registration/manifests to v0.3.0, introduces documentation (PLUGINS.md, README, command and skill docs), and adds plugins/golang/OWNERS.

Changes

CVE Patching Command and Skill

Layer / File(s) Summary
Plugin registration and metadata updates
.claude-plugin/marketplace.json, plugins/golang/.claude-plugin/plugin.json, docs/data.json
Plugin version bumped to 0.3.0 and CVE patching capability registered across marketplace registry, plugin manifest, and command/skill data structures.
User-facing documentation
PLUGINS.md, plugins/golang/README.md
PLUGINS.md adds Golang plugin table-of-contents entry and full section describing the /golang:fix-cve command; README.md adds Commands section with usage and argument details.
Command specification and contract
plugins/golang/commands/fix-cve.md
Defines /golang:fix-cve with three patching strategies (Path A: direct update, Path B: patch bump, Path C: fork-based replace) based on Go version compatibility, required arguments, implementation flow steps, PR creation rules, and usage examples.
Skill implementation workflow and troubleshooting
plugins/golang/skills/fix-cve/SKILL.md
Details the end-to-end implementation: strategy selection via version-info gathering, discovery of affected go.mod files, vendor synchronization with environment handling, validation via make update/verify, commit/PR creation, explicit hard-stop conditions, and troubleshooting for vendor errors, macOS dyld issues, and workspace sync behavior.
Project ownership and access control
plugins/golang/OWNERS
Establishes approvers and reviewers list for the Go plugin with nine specified maintainers.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • openshift-eng/ai-helpers#474: Adds plugins/golang/OWNERS related CI lint rule enforcement and is directly connected to the OWNERS addition here.
  • openshift-eng/ai-helpers#190: Also updates golang plugin registration/docs to add lint-related commands; overlaps on files modified for plugin registration.
  • openshift-eng/ai-helpers#449: Modifies golang plugin metadata and command/skill surface; related to prior tooling changes referenced in this PR.

Suggested labels

approved, lgtm

Suggested reviewers

  • rvanderp3
  • bryan-cox
🚥 Pre-merge checks | ✅ 10
✅ Passed checks (10 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
No Real People Names In Style References ✅ Passed No real people names found used as style references in plugin commands, skill documentation, example prompts, or instructions throughout the PR files.
No Assumed Git Remote Names ✅ Passed PR documentation explicitly requires discovering git remotes via git remote -v (fix-cve.md line 48, SKILL.md line 164). No hardcoded remote names found.
Git Push Safety Rules ✅ Passed The PR's /golang:fix-cve command documentation explicitly requires user permission before pushing, forbids main/master pushes, and forbids all force push variants.
No Untrusted Mcp Servers ✅ Passed PR introduces no untrusted MCP servers. Only gopls (official Go team MCP server) is configured via its built-in mcp subcommand, not via untrusted npm packages or arbitrary GitHub repos.
Ai-Helpers Overlap Detection ✅ Passed golang:fix-cve adds CVE-specific patching. No ≥60% overlap found: vs compliance:analyze-cve (complementary assessment), vs openshift:bump-deps (orthogonal general deps). New to golang plugin.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main change: adding a fix-cve skill to the golang plugin for CVE patching.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 14, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@plugins/deps/commands/fix-cve.md`:
- Around line 12-14: The fenced code blocks containing the directive
"/deps:fix-cve module=\"google.golang.org/grpc\" fix-version=... cve=...
ticket=..." lack language identifiers and trigger markdownlint MD040; update
each fence (including the occurrences around the shown diff and at the other
locations noted, e.g., lines 54-61 and 65-67) to include a language tag such as
"text" (i.e., change ``` to ```text) so the blocks are properly identified while
leaving the directive content unchanged.
- Around line 44-45: Update the "PR creation" step of the fix-cve command to add
explicit push/PR safety gates: require an interactive confirmation before any
git push or PR creation (no implicit pushes), block pushes/PRs to main or master
branches unless a specific override is explicitly provided and confirmed,
prohibit any force-push unless a clearly named allow-force flag (e.g.,
--allow-force) is set and confirmed interactively, and require explicit remote
selection (do not assume "origin") or prompt the user to confirm the remote;
document the new flags and prompts in the PR creation section of fix-cve.md and
ensure the implementation checks these guards before running git push or
creating a PR.

In `@plugins/deps/skills/fix-cve/SKILL.md`:
- Around line 67-70: The markdown in SKILL.md has multiple fenced code blocks
missing language identifiers (MD040); update each triple-backtick fence shown
around the examples (the blocks containing "// <CVE number> replace
<original-module> => <fork-module> <fork-version>", the "fix(deps): <action>
<module-name> to fix <CVE>" example, the "[<branch>] <TICKET>: fix <CVE> by
<action> <module-name>" line, and the /deps:fix-cve
module="google.golang.org/grpc" ... example) to include a language tag such as
text (e.g., change ``` to ```text) for all affected ranges (67-70, 142-149,
161-163, 194-201) so the markdown linter MD040 is satisfied.
- Around line 158-170: The PR guidance in Step 6 of SKILL.md currently allows
push/PR actions without safety checks; update the Step 6 text and any associated
workflow logic so that before any push/PR the tool must prompt and obtain
explicit user permission, explicitly forbid pushing to branch names "main" or
"master", disallow any force-push semantics, and avoid assuming remote names
(require the user to confirm or supply the remote). Locate and modify the Step 6
section and any code that auto-executes git push/pr actions referenced by the PR
format examples to add these checks and clear user prompts.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 6fca6ae4-351d-423e-b12c-bd548794ca3f

📥 Commits

Reviewing files that changed from the base of the PR and between 2550735 and ebe15f6.

📒 Files selected for processing (7)
  • .claude-plugin/marketplace.json
  • PLUGINS.md
  • docs/data.json
  • plugins/deps/.claude-plugin/plugin.json
  • plugins/deps/README.md
  • plugins/deps/commands/fix-cve.md
  • plugins/deps/skills/fix-cve/SKILL.md

Comment thread plugins/deps/commands/fix-cve.md Outdated
Comment thread plugins/deps/commands/fix-cve.md Outdated
Comment thread plugins/deps/skills/fix-cve/SKILL.md Outdated
Comment thread plugins/golang/skills/fix-cve/SKILL.md
Comment thread .claude-plugin/marketplace.json Outdated
"version": "0.1.2"
},
{
"name": "deps",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The footprint is really small, does it need its own plugin? Could it go to a new cve plugin, or maybe golang ? I expect we'll have more in this space

@jparrill jparrill May 18, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve put it in there, because I though it’s not a pure CVE plugin perse, it’s not fixing a CVE, but patching deps for a CVE fix xD. W/e is fine to me tbh :). Let me know to reformulate the best suitable way.

Comment thread plugins/golang/OWNERS Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error (plugin-owners-required): Plugin 'golang' has an OWNERS file but is still in the exclude list — remove it from the exclusion

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THere's an exclusion in .skillsaw.yaml if you'll add an OWNERS for this plugin

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
plugins/golang/skills/fix-cve/SKILL.md (1)

82-85: ⚡ Quick win

Consider a more precise grep pattern to identify affected modules.

The current pattern grep "<module>" path/to/go.mod may match the module name in comments, as part of another module's name, or in unrelated contexts. A more targeted pattern would reduce false positives and unnecessary processing.

♻️ Suggested improvement
-For each `go.mod`, check if it references the target module:
-```bash
-grep "<module>" path/to/go.mod
-```
+For each `go.mod`, check if it actually depends on or replaces the target module:
+```bash
+grep -E "^\s*(require|replace).*<module>" path/to/go.mod
+```

This anchors the search to require or replace directives at the start of lines (after optional whitespace), avoiding matches in comments or as substrings of other module paths.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/golang/skills/fix-cve/SKILL.md` around lines 82 - 85, Update the grep
pattern used to detect references to the target module in go.mod so it only
matches dependency directives, not comments or substrings: replace the current
naive grep of "<module>" with a anchored regex that looks for require or replace
directives (e.g., grep -E "^\s*(require|replace).*<module>" path/to/go.mod) so
the check targets actual require/replace lines in go.mod rather than any
occurrence of "<module>".
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/data.json`:
- Around line 1724-1728: Replace the placeholder description "|" for the skill
with id "fix-cve" / name "fix-cve" by adding a clear, actionable description
that explains what the skill does, when to use it, expected inputs and outputs,
and any preconditions; locate the JSON object containing "id": "fix-cve" and
update its "description" field to a meaningful sentence or two similar in level
of detail to nearby golang plugin entries so users understand the command's
purpose and usage.

---

Nitpick comments:
In `@plugins/golang/skills/fix-cve/SKILL.md`:
- Around line 82-85: Update the grep pattern used to detect references to the
target module in go.mod so it only matches dependency directives, not comments
or substrings: replace the current naive grep of "<module>" with a anchored
regex that looks for require or replace directives (e.g., grep -E
"^\s*(require|replace).*<module>" path/to/go.mod) so the check targets actual
require/replace lines in go.mod rather than any occurrence of "<module>".
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: f9587b71-b2e1-4aaa-a953-62128116b363

📥 Commits

Reviewing files that changed from the base of the PR and between ebe15f6 and 4c85341.

📒 Files selected for processing (8)
  • .claude-plugin/marketplace.json
  • PLUGINS.md
  • docs/data.json
  • plugins/golang/.claude-plugin/plugin.json
  • plugins/golang/OWNERS
  • plugins/golang/README.md
  • plugins/golang/commands/fix-cve.md
  • plugins/golang/skills/fix-cve/SKILL.md
✅ Files skipped from review due to trivial changes (5)
  • plugins/golang/OWNERS
  • plugins/golang/.claude-plugin/plugin.json
  • plugins/golang/commands/fix-cve.md
  • plugins/golang/README.md
  • PLUGINS.md

Comment thread docs/data.json
Comment thread plugins/golang/OWNERS Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THere's an exclusion in .skillsaw.yaml if you'll add an OWNERS for this plugin

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude and Cursor have both de-emphasized commands in favor of skills, as it usually doesn't make sense to split them. I have also seen issues where skills and commands with the same name have Claude confused, it may make sense to just publish this as one skill.

Skills are invocable as a "/" command for some time in Claude.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Consolidating both :)

@stbenjam

Copy link
Copy Markdown
Member

One optional comment, but the lint needs to be fixed about OWNERS, otherwise lgtm.

Thank you!

@jparrill
jparrill force-pushed the patch-cve branch 2 times, most recently from ab76093 to d4be312 Compare May 20, 2026 07:58
Signed-off-by: Jose Parrill <jparrill@redhat.com>
Signed-off-by: Juan Manuel Parrilla Madrid <jparrill@redhat.com>
@jparrill jparrill changed the title Add deps plugin with fix-cve command for Go CVE patching Add fix-cve skill to golang plugin for Go CVE patching May 20, 2026
@stbenjam

Copy link
Copy Markdown
Member

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 20, 2026
@openshift-ci

openshift-ci Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jparrill, stbenjam

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 20, 2026
@openshift-merge-bot
openshift-merge-bot Bot merged commit 80b7f1e into openshift-eng:main May 20, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants