Skip to content

ci: add semgrep scan on PRs to main - #15

Merged
hassan-bazzi merged 3 commits into
mainfrom
ci/semgrep-pr-scan
Jul 14, 2026
Merged

ci: add semgrep scan on PRs to main#15
hassan-bazzi merged 3 commits into
mainfrom
ci/semgrep-pr-scan

Conversation

@neeythann

@neeythann neeythann commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

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.

  • Runs in the official semgrep/semgrep container, so no install step
  • semgrep scan --config p/golang --config p/secrets --error — Go ruleset + secrets detection, fails the job on findings

Summary by CodeRabbit

  • Chores
    • Added automated security scanning for pull requests targeting the main branch.
    • Scans now check Go code and potential secrets, reporting detected issues as workflow errors.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@neeythann, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 51 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e5e5c509-83ac-4c00-868b-d8ff0b7aa417

📥 Commits

Reviewing files that changed from the base of the PR and between 23df795 and f2b6d37.

📒 Files selected for processing (2)
  • .github/workflows/semgrep.yml
  • pkg/deploy/hostname.go
📝 Walkthrough

Walkthrough

Adds a GitHub Actions workflow that runs Semgrep in a container for pull requests targeting main, scanning with Go and secrets rules and failing on detected errors.

Changes

Semgrep CI workflow

Layer / File(s) Summary
Configure Semgrep pull request scanning
.github/workflows/semgrep.yml
Triggers on pull requests to main, grants read-only contents access, checks out the repository, and runs Semgrep with p/golang, p/secrets, and --error.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the new CI workflow that runs Semgrep scans on pull requests targeting main.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/semgrep-pr-scan

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 (2)
.github/workflows/semgrep.yml (2)

15-25: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Consider adding a job/step timeout.

No timeout-minutes is 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 win

Disable credential persistence on checkout.

actions/checkout@v4 persists the GitHub token in the local git config by default (flagged by zizmor as artipacked), 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

📥 Commits

Reviewing files that changed from the base of the PR and between c588761 and 23df795.

📒 Files selected for processing (1)
  • .github/workflows/semgrep.yml

Comment thread .github/workflows/semgrep.yml Outdated
@hassan-bazzi
hassan-bazzi merged commit b7dd9f1 into main Jul 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants