man@mndev:~/portfolio/notes/devops
← portfolio

Rolling out security scanning to 20+ repos with reusable workflows

SAST, code quality and dependency checks across many repositories, without copy-pasting YAML into every one.

DevOps··1 min read

Adding a security scan to one repo takes an afternoon. Adding it to twenty-plus repositories, and keeping them consistent, is a different problem. Copy-pasted YAML drifts within weeks. Here’s the approach that worked for rolling out SAST (Veracode), code quality (SonarQube) and dependency remediation.

One workflow, many callers

GitHub Actions reusable workflows let you define the pipeline once, in a central repo:

# org/ci-templates/.github/workflows/security.yml
on:
  workflow_call:
    inputs:
      language: { type: string, required: true }
    secrets:
      SONAR_TOKEN: { required: true }
jobs:
  sonar:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      # ... build, test with coverage, scan

Each product repo just calls it:

jobs:
  security:
    uses: org/ci-templates/.github/workflows/security.yml@v1
    with: { language: node }
    secrets: inherit

Fixing or upgrading a scanner now means one pull request, then bumping the tag.

Roll out in two phases

Turning on a hard gate on day one blocks every team at once. Instead:

  1. Report-only. Run the scans, publish results, fail nothing. This gives you a baseline per repo.
  2. Gate on new issues. Fail builds only on new findings above a severity threshold, while the backlog gets worked down separately.

Work the backlog like product work

Dependency findings are mostly upgrades. Group them by fix, not by repo: one framework bump can close findings in ten places. Track them on a board with owners. Some fixes are real migrations (a bundler major, say) and deserve their own ticket and review.

Make it visible

The technical setup was the easy part. Consistency, a gentle rollout and clear ownership are what made scanning stick.

// related