ci: add govulncheck workflow#131
Conversation
📝 WalkthroughWalkthroughAdds a new GitHub Actions workflow that runs Changes
Sequence Diagram(s)sequenceDiagram
actor Dev as Dev
participant GH as GitHub Actions
participant Runner as Ubuntu Runner
participant Repo as Repository
participant GoTool as Go toolchain
participant Govuln as govulncheck
Dev->>GH: push / open PR / schedule / manual
GH->>Runner: start workflow (concurrency enforced)
Runner->>Repo: actions/checkout
Runner->>GoTool: setup-go (1.25)
Runner->>Runner: go install golang.org/x/vuln/cmd/govulncheck@latest
Runner->>Govuln: run "govulncheck ./..."
Govuln-->>Runner: scan results
Runner-->>GH: report status & logs
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
.github/workflows/govulncheck.yml (2)
6-7:pull_request.branches: ["**"]is redundantLine 6–7 can be simplified; PR workflows already trigger for all target branches by default when
branchesis omitted.Proposed simplification
push: branches: [main] pull_request: - branches: ["**"] schedule:🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/govulncheck.yml around lines 6 - 7, The pull_request.branches: ["**"] entry is redundant; remove the branches key (and its array) under the pull_request trigger in govulncheck.yml so the workflow uses the default behavior of running on all target branches. Locate the pull_request: block and delete the branches: ["**"] mapping (only that key and value), leaving pull_request: by itself or removing the empty mapping entirely.
21-23: Addtimeout-minutesto avoid hung vulnerability scansLine 21 creates a job with no upper bound. A timeout improves CI reliability and runner utilization if the scan hangs.
Proposed fix
jobs: govulncheck: runs-on: ubuntu-latest name: Run govulncheck + timeout-minutes: 15 steps:🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/govulncheck.yml around lines 21 - 23, The "Run govulncheck" job currently has no timeout and can hang; add a timeout-minutes key to the job block (the YAML section containing runs-on: ubuntu-latest and name: Run govulncheck) to set an upper bound (e.g., timeout-minutes: 30) so the workflow cancels long-running govulncheck scans and frees the runner.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/govulncheck.yml:
- Around line 19-23: Add an explicit permissions block to the govulncheck job to
enforce least privilege: inside the govulncheck job definition (symbol:
govulncheck) add a permissions mapping that grants only the minimal read scopes
required (e.g., contents: read, packages: read, security-events: write if needed
by govulncheck) so GITHUB_TOKEN no longer inherits repo/org defaults; ensure the
permissions block is at the same indentation level as runs-on and name.
---
Nitpick comments:
In @.github/workflows/govulncheck.yml:
- Around line 6-7: The pull_request.branches: ["**"] entry is redundant; remove
the branches key (and its array) under the pull_request trigger in
govulncheck.yml so the workflow uses the default behavior of running on all
target branches. Locate the pull_request: block and delete the branches: ["**"]
mapping (only that key and value), leaving pull_request: by itself or removing
the empty mapping entirely.
- Around line 21-23: The "Run govulncheck" job currently has no timeout and can
hang; add a timeout-minutes key to the job block (the YAML section containing
runs-on: ubuntu-latest and name: Run govulncheck) to set an upper bound (e.g.,
timeout-minutes: 30) so the workflow cancels long-running govulncheck scans and
frees the runner.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 275cfac3-9d2a-4109-bae8-157ecf098301
📒 Files selected for processing (1)
.github/workflows/govulncheck.yml
2fe1958 to
3e665b7
Compare
6c0eafe to
e211896
Compare
ci: add govulncheck workflow
Motivation 💡
We had no automated check for known CVEs in our Go dependencies. Adding
govulncheckto CI catches newly disclosed vulnerabilities on every PR, on push tomain, and on a weekly schedule, so issues surface even when no code is changing.Changes 🛠
.github/workflows/govulncheck.ymlrunning onpushtomain,pull_request, weekly cron (Mondays 09:00 UTC), andworkflow_dispatchcontents: read(least privilege, no write access needed)govulncheckdirectly viaactions/setup-go+go installinstead ofgolang/govulncheck-action, which fails with a duplicateAuthorizationheader on current runnersactions/checkoutandactions/setup-goto commit SHAsConsiderations 🤔
Workflow failing as expected. govulncheck reports vulnerabilities pulled in transitively through
cosmos-sdk/cosmos-evm. Cannot be fixed here. Need upstream bump first to keep compatibility.Summary by CodeRabbit