ci: add Go vulnerability scanning with govulncheck and gosec#310
Conversation
Add govulncheck and gosec CI jobs that run on PRs, pushes to main, and weekly on a schedule to catch newly disclosed vulnerabilities. - govulncheck: checks Go dependencies against the official vuln database - gosec: static analysis for high-severity security patterns Closes KiiChain#65
WalkthroughA new GitHub Actions workflow is introduced for automated Go vulnerability scanning. The workflow triggers on pushes to Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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.
🧹 Nitpick comments (1)
.github/workflows/go-vuln-scan.yml (1)
3-18: Consider addingworkflow_dispatchfor manual triggering.Adding
workflow_dispatchallows manually re-running the scan after fixing vulnerabilities or when investigating a newly disclosed CVE without waiting for the scheduled run.💡 Suggested enhancement
on: push: branches: - main paths: - "**.go" - "go.mod" - "go.sum" pull_request: paths: - "**.go" - "go.mod" - "go.sum" schedule: # Run weekly on Monday at 08:00 UTC to catch newly disclosed vulnerabilities - cron: "0 8 * * 1" + workflow_dispatch:🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/go-vuln-scan.yml around lines 3 - 18, Add a manual trigger to the GitHub Actions workflow by including workflow_dispatch under the top-level on: triggers (alongside push, pull_request, and schedule) so the go-vuln-scan job can be run on-demand; update the on: block that currently contains push, pull_request, and schedule to also list workflow_dispatch so maintainers can manually trigger scans without waiting for the scheduled cron run.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.github/workflows/go-vuln-scan.yml:
- Around line 3-18: Add a manual trigger to the GitHub Actions workflow by
including workflow_dispatch under the top-level on: triggers (alongside push,
pull_request, and schedule) so the go-vuln-scan job can be run on-demand; update
the on: block that currently contains push, pull_request, and schedule to also
list workflow_dispatch so maintainers can manually trigger scans without waiting
for the scheduled cron run.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: ed7bb0a1-e0d0-4c24-9201-a6115708b41d
📒 Files selected for processing (2)
.github/workflows/go-vuln-scan.ymlCHANGELOG.md
There was a problem hiding this comment.
Pull request overview
Adds automated Go security scanning to the CI pipeline to detect known dependency vulnerabilities and common security anti-patterns, addressing #65.
Changes:
- Introduces a new GitHub Actions workflow running
govulncheckandgosecin parallel. - Configures workflow triggers for PRs/pushes touching Go-related files plus a weekly scheduled run.
- Updates
CHANGELOG.mdunder Unreleased → Added to document the new CI check.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
.github/workflows/go-vuln-scan.yml |
Adds a Go vulnerability scanning workflow with govulncheck + gosec jobs and scheduled execution. |
CHANGELOG.md |
Documents the addition of the Go vulnerability scanning workflow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| check-latest: true | ||
|
|
||
| - name: Run gosec | ||
| uses: securego/gosec@master |
There was a problem hiding this comment.
The workflow pins the gosec action to securego/gosec@master, which is a moving target and can introduce supply-chain risk and non-reproducible CI behavior. Pin this to a tagged release or (preferably) a specific commit SHA, and consider using Dependabot to keep it updated.
| uses: securego/gosec@master | |
| uses: securego/gosec@v2.21.0 |
| check-latest: true | ||
|
|
||
| - name: Install govulncheck | ||
| run: go install golang.org/x/vuln/cmd/govulncheck@latest |
There was a problem hiding this comment.
Installing govulncheck with @latest makes the CI run non-reproducible and can cause unexpected failures when upstream releases change behavior. Prefer pinning to a specific govulncheck version (or a known-good commit) and updating it intentionally.
| run: go install golang.org/x/vuln/cmd/govulncheck@latest | |
| run: go install golang.org/x/vuln/cmd/govulncheck@v1.1.0 |
|
Hi @jhelison — friendly ping! This PR is ready for review whenever you have a moment. All CI checks are passing. Happy to address any feedback. Thanks! |
|
Hey @Thaleszh, would love to get your eyes on this when you have a moment. Thanks! |
Summary
Adds a Go vulnerability scanning CI workflow that integrates govulncheck and gosec into the pipeline, as requested in #65.
Changes
New: .github/workflows/go-vuln-scan.yml
Two parallel jobs:
govulncheck (official Go vulnerability database)
gosec (static security analysis)
Triggers
Modified: CHANGELOG.md
Design Decisions
Closes #65