From 2f67b84e344a0044c296a719db95d553f37f7e06 Mon Sep 17 00:00:00 2001 From: Quinn Milionis Date: Mon, 2 Nov 2026 14:19:37 -0800 Subject: [PATCH] Add Semgrep SAST workflow Runs Semgrep (p/default) on every PR to main. PRs are diff-aware, so only findings a PR introduces fail the check. Pushes to main run a full, report-only scan. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01NgEiZxpTQEsuZCXUbkYwXe --- .github/workflows/semgrep.yml | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/semgrep.yml diff --git a/.github/workflows/semgrep.yml b/.github/workflows/semgrep.yml new file mode 100644 index 0000000..dc075ae --- /dev/null +++ b/.github/workflows/semgrep.yml @@ -0,0 +1,42 @@ +name: Semgrep + +# Static analysis (Semgrep) on every PR to main. +# PRs are diff-aware: only findings a PR introduces fail the check, so the +# existing backlog doesn't block merges. Pushes to main run a full, report-only scan. + +on: + pull_request: + branches: + - main + push: + branches: + - main + workflow_dispatch: + +permissions: + contents: read + +jobs: + semgrep: + name: Semgrep SAST + runs-on: ubuntu-latest + timeout-minutes: 15 + container: + image: semgrep/semgrep:1.183.0 + + steps: + - name: Checkout code + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + fetch-depth: 0 + + - name: Scan + env: + BASE_SHA: ${{ github.event.pull_request.base.sha }} + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + if [ -n "$BASE_SHA" ]; then + semgrep scan --config p/default --metrics=off --error --baseline-commit "$BASE_SHA" + else + semgrep scan --config p/default --metrics=off + fi