Built-in security scan job on the runners #340

closed cmc opened this on 2026-10-31 06:12 UTC

Discussion

cmc 2026-10-31 06:12 UTC

Code scanning (Opengrep, gosec) and container image scanning (Grype) need a checkout and run as separate, memory-heavy binaries. They belong on the runners, not in gitbayd, which would otherwise parse untrusted repository content in the daemon process. Today each repository has to define its own job in .gitbay/ci.yml.

Approach:

  • repo security enable makes the scheduler queue a gitbay-defined security job for the repository on a schedule, independent of the repository's own ci.yml.
  • The job runs in a maintained image with every scanner pinned to an exact version and verified by sha256. The existing quality and vuln jobs have the same gap: they fetch the Qlty tarball with curl and no checksum.
  • The runner protocol gains a structured result upload (SARIF); runner log and runner done carry only text and status.
  • Findings are stored per repository, deduplicated across runs by fingerprint, and shown as one issue per repository with the deps issue's lifecycle, or on a security page.

Open questions: runner capacity on bay1 (1 GB, shared with gitbayd) for nightly scans across all opted-in repositories, and whether a second runner host is a prerequisite; where the Opengrep rule set comes from and how often it updates.

closed by cmc in commit 39dad8f75c: Scheduled code scanning on the runners

2026-10-31 06:58 UTC