From 902ede6505343df51c767c4466b72bbb3dbdd78d Mon Sep 17 00:00:00 2001 From: Mike Wolf Date: Mon, 16 Nov 2026 23:08:05 -0500 Subject: [PATCH] ci: add gitleaks secret scan Runs gitleaks on every pull request and on every push to main. Part of PF-1540 Co-Authored-By: Claude Fable 5.2 --- .github/workflows/gitleaks.yml | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/gitleaks.yml diff --git a/.github/workflows/gitleaks.yml b/.github/workflows/gitleaks.yml new file mode 100644 index 0000000..f202e77 --- /dev/null +++ b/.github/workflows/gitleaks.yml @@ -0,0 +1,40 @@ +# Secret scan: fails a PR (and comments on it) when a commit adds a key, token or password. +# +# This repository is public, so it cannot call the org's shared workflow in the private +# Blockworks-Projects/workflows repository. This is a standalone copy of that workflow's scan job; +# keep the pinned versions in step with Blockworks-Projects/workflows/.github/workflows/gitleaks.yml. +# +# A finding means the secret is compromised even if the commit is reverted: rotate it first, then remove it. +# Allowlist a false positive in a gitleaks.toml at the repo root (gitleaks reads it automatically). + +name: Secret scan + +on: + pull_request: + push: + branches: [main] + +permissions: {} + +jobs: + gitleaks: + name: gitleaks + runs-on: ubuntu-latest + timeout-minutes: 15 + permissions: + contents: read # clone the repository + pull-requests: write # comment on the PR when a secret is found + steps: + - name: Check out repository + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 + with: + fetch-depth: 0 # full history, so every commit in the event range is available + + - name: Scan for secrets + uses: gitleaks/gitleaks-action@e0c47f4f8be36e29cdc102c57e68cb5cbf0e8d1e # v3.0.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }} # organisation secret + GITLEAKS_ENABLE_COMMENTS: "true" + GITLEAKS_ENABLE_SUMMARY: "true" + GITLEAKS_ENABLE_UPLOAD_ARTIFACT: "true"