Skip to content

feat(semgrep): add a reusable Semgrep CE scan workflow - #198

Merged
twistedmelonman merged 2 commits into
mainfrom
claude/feat-semgrep-scan
Oct 22, 2026
Merged

twistedmelonman merged 2 commits into
mainfrom
claude/feat-semgrep-scan

Conversation

@twistedmelonman

Copy link
Copy Markdown
Member

Summary

  • Adds semgrep-scan.yml, a reusable workflow that runs Semgrep CE as a stand-in for CodeQL on private repos without GitHub Code Security.
  • On pull_request it fails only on findings new in the PR (--baseline-commit at the PR base). push and workflow_dispatch scan the whole tree.
  • An optional SEMGREP_APP_TOKEN switches it to semgrep ci, so the Semgrep platform can be adopted later without a caller change.
  • Semgrep is pinned in semgrep/requirements.txt; Dependabot bumps it. No SARIF upload, since that needs Code Security on private repos.
  • Caller stub: semgrep/caller-stub.yml, pinned to @semgrep-scan-v1 (tag created after merge).

Advances smartwatermelon/dev-env#166.

Test plan

  • bash tests/test-semgrep-scan.sh: 16 hermetic cases against a stub semgrep (event routing, baseline SHA validation, ruleset validation, token path, and workflow/stub/README agreement).
  • shellcheck -S info, actionlint and zizmor clean locally.
  • Live check comes from the pilot caller on nightowlstudiollc/reliquarist after the tag exists.

Claude Code Bot added 2 commits October 21, 2026 19:28
The private nightowlstudiollc repos get no CodeQL without GitHub Code
Security, which was declined. semgrep-scan.yml runs Semgrep Community
Edition in its place.

- pull_request: semgrep scan --error with --baseline-commit at the PR
  base, so only findings new in the PR fail. push and workflow_dispatch
  scan the whole tree.
- An optional SEMGREP_APP_TOKEN switches the run to semgrep ci; the
  platform's policies then replace the rulesets input.
- The job has contents: read only. No SARIF upload, because code scanning
  on a private repo needs the SKU this replaces.
- The mode logic is semgrep/run-semgrep.sh, checked out at
  job.workflow_sha like netlify/. Semgrep 1.182.0 is pinned in
  semgrep/requirements.txt, installed into a venv, and bumped by a new
  pip entry in dependabot.yml.
- tests/test-semgrep-scan.sh covers each mode against a stub semgrep.
  run-tests.sh already globs test-*.sh, so it needs no change.

Not a required check. Advances smartwatermelon/dev-env#166.
A full scan on push keeps main honest: findings that predate a PR still
show up. Repos fix their existing findings before adding the caller, so
the first push run is green.

Advances smartwatermelon/dev-env#166.
@twistedmelonman
twistedmelonman merged commit 2cf8715 into main Oct 22, 2026
5 checks passed
@twistedmelonman
twistedmelonman deleted the claude/feat-semgrep-scan branch October 22, 2026 02:43
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.

1 participant