ci: add semgrep scan on PRs to main - #15
Conversation
|
Warning Review limit reached
Next review available in: 51 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds a GitHub Actions workflow that runs Semgrep in a container for pull requests targeting ChangesSemgrep CI workflow
Estimated code review effort: 1 (Trivial) | ~5 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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.
Actionable comments posted: 1
🧹 Nitpick comments (2)
.github/workflows/semgrep.yml (2)
15-25: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winConsider adding a job/step timeout.
No
timeout-minutesis set, so a hung Semgrep scan could block the job indefinitely and consume runner minutes.🤖 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 @.github/workflows/semgrep.yml around lines 15 - 25, Add a finite timeout-minutes setting to the semgrep job containing the “Run Semgrep” step, using a value appropriate for the scan so hung executions terminate and do not run indefinitely.
21-22: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick winDisable credential persistence on checkout.
actions/checkout@v4persists the GitHub token in the local git config by default (flagged by zizmor asartipacked), which is unnecessary here since the job only needs to read the code for scanning.🔒️ Proposed fix
- name: Checkout uses: actions/checkout@v4 + with: + persist-credentials: false🤖 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 @.github/workflows/semgrep.yml around lines 21 - 22, Update the actions/checkout@v4 step in the workflow to disable credential persistence by configuring persist-credentials as false, while leaving the checkout behavior unchanged for the scanning job.Source: Linters/SAST tools
🤖 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 @.github/workflows/semgrep.yml:
- Around line 18-19: Pin the container image used by the workflow to a specific
Semgrep version tag or immutable digest instead of the floating semgrep/semgrep
latest image. Update the container configuration while preserving the existing
Semgrep workflow behavior.
---
Nitpick comments:
In @.github/workflows/semgrep.yml:
- Around line 15-25: Add a finite timeout-minutes setting to the semgrep job
containing the “Run Semgrep” step, using a value appropriate for the scan so
hung executions terminate and do not run indefinitely.
- Around line 21-22: Update the actions/checkout@v4 step in the workflow to
disable credential persistence by configuring persist-credentials as false,
while leaving the checkout behavior unchanged for the scanning job.
🪄 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: cd5f7e46-bf37-4377-99f4-c6cde3e2f1c9
📒 Files selected for processing (1)
.github/workflows/semgrep.yml
Adds a GitHub Actions workflow that runs a free/OSS Semgrep scan (no Semgrep AppSec Platform token required) on every pull request targeting
main, including re-runs when new commits are pushed to an open PR.semgrep/semgrepcontainer, so no install stepsemgrep scan --config p/golang --config p/secrets --error— Go ruleset + secrets detection, fails the job on findingsSummary by CodeRabbit