ci: add gitleaks secret-scan job (compliance #171)#215
ci: add gitleaks secret-scan job (compliance #171)#215
Conversation
Adds the required `secret-scan` job per the org push-protection standard (standards/push-protection.md#layer-3--ci-secret-scanning-secondary-defense). The job: - Checks out full git history (fetch-depth: 0) for complete scan coverage - Runs gitleaks/gitleaks-action@v2.3.9 pinned to SHA ff98106e4c7b2bc287b24eaf42907196329070c7 - Passes --redact to prevent secrets appearing in logs - Passes --exit-code 1 to fail the build on any finding - Passes GITLEAKS_LICENSE from secrets to satisfy the org-repo license requirement (prior attempt PR #198 omitted this env var, causing the CI failure) Resolves the `secret_scan_ci_job_present` compliance finding. Co-authored-by: don-petry <don-petry@users.noreply.github.com>
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 46 minutes and 15 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
@don-petry — this PR implements the CI failure: missing GITLEAKS_LICENSE
To unblock
Once merged, the
|
There was a problem hiding this comment.
Pull request overview
Adds a new CI job to run Gitleaks secret scanning to satisfy org push-protection compliance requirements and address issue #171.
Changes:
- Add a
secret-scanjob to.github/workflows/ci.ymlusinggitleaks/gitleaks-actionwith SHA-pinned actions. - Configure full-history checkout and run
gitleaks detectwith redaction and failure on findings. - Pass
GITLEAKS_LICENSEvia workflow env (alongsideGITHUB_TOKEN).
| secret-scan: | ||
| name: Secret scan (gitleaks) | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| security-events: write |
There was a problem hiding this comment.
On pull_request events from forks, secrets.GITLEAKS_LICENSE will not be available and the GITHUB_TOKEN cannot be granted security-events: write, so this job is likely to fail for fork PRs (the rest of this workflow already has fork-specific handling). Consider adding an if: guard to run this job only on pushes and same-repo PRs, or otherwise skipping/uploading conditionally when the license/token permissions aren’t available.
| # Pin to SHA per Action Pinning Policy (ci-standards.md#action-pinning-policy). | ||
| # Look up current SHA: gh api repos/actions/checkout/git/refs/tags/v4 --jq '.object.sha' | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Run gitleaks | ||
| # Pinned to SHA per Action Pinning Policy (ci-standards.md#action-pinning-policy). |
There was a problem hiding this comment.
The pinning-policy reference points to ci-standards.md#action-pinning-policy, but this repository doesn’t contain ci-standards.md. Update the comment to reference an existing doc/location (e.g., the org standards link in AGENTS.md) or remove it to avoid a dead reference.
| # Pin to SHA per Action Pinning Policy (ci-standards.md#action-pinning-policy). | |
| # Look up current SHA: gh api repos/actions/checkout/git/refs/tags/v4 --jq '.object.sha' | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Run gitleaks | |
| # Pinned to SHA per Action Pinning Policy (ci-standards.md#action-pinning-policy). | |
| # Pin to a commit SHA. | |
| # Look up current SHA: gh api repos/actions/checkout/git/refs/tags/v4 --jq '.object.sha' | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Run gitleaks | |
| # Pin to a commit SHA. |
| steps: | ||
| - name: Checkout (full history) | ||
| # Pin to SHA per Action Pinning Policy (ci-standards.md#action-pinning-policy). | ||
| # Look up current SHA: gh api repos/actions/checkout/git/refs/tags/v4 --jq '.object.sha' |
There was a problem hiding this comment.
The "Look up current SHA" command references tags/v4, but the workflow is using an action version comment of v6.0.2 (and elsewhere in the repo actions/checkout is annotated as v6). Update the tag in the lookup command (or the version annotation) so maintainers fetch the correct SHA when refreshing pins.
| # Look up current SHA: gh api repos/actions/checkout/git/refs/tags/v4 --jq '.object.sha' | |
| # Look up current SHA: gh api repos/actions/checkout/git/refs/tags/v6.0.2 --jq '.object.sha' |
| # Pin to SHA per Action Pinning Policy (ci-standards.md#action-pinning-policy). | ||
| # Look up current SHA: gh api repos/actions/checkout/git/refs/tags/v4 --jq '.object.sha' | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Run gitleaks | ||
| # Pinned to SHA per Action Pinning Policy (ci-standards.md#action-pinning-policy). |
There was a problem hiding this comment.
This pinning-policy comment again references ci-standards.md#action-pinning-policy, which doesn’t exist in this repo. Align the reference with an existing standard/documentation source so future updates don’t dead-end.
| # Pin to SHA per Action Pinning Policy (ci-standards.md#action-pinning-policy). | |
| # Look up current SHA: gh api repos/actions/checkout/git/refs/tags/v4 --jq '.object.sha' | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Run gitleaks | |
| # Pinned to SHA per Action Pinning Policy (ci-standards.md#action-pinning-policy). | |
| # Pin to a full commit SHA per GitHub Actions security hardening guidance: | |
| # https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions | |
| # Look up current SHA: gh api repos/actions/checkout/git/refs/tags/v4 --jq '.object.sha' | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Run gitleaks | |
| # Pinned to a full commit SHA per GitHub Actions security hardening guidance: | |
| # https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions |



Summary
secret-scanjob to.github/workflows/ci.ymlper the org push-protection standardsecret_scan_ci_job_presentcompliance finding from issue Compliance: secret_scan_ci_job_present #171What was added
Why this PR over #198
PR #198 had the correct action reference but CI failed because
GITLEAKS_LICENSEwas not passed in theenv:block.gitleaks-action@v2requires this for organization repos. This PR addsGITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}— if the org secret is configured, CI will pass.If CI still fails on "Secret scan (gitleaks)": the
GITLEAKS_LICENSEsecret needs to be added at the org or repo level (obtain from gitleaks.io).Compliance check satisfied
The weekly audit greps for
uses: gitleaks/gitleaks-action@inci.yml— this PR satisfies that check.Closes #171
Generated with Claude Code