Skip to content

ci(github): add full-history gitleaks scans - #5

Merged
rbright merged 1 commit into
mainfrom
feature/gitleaks-full-history-scans
Nov 29, 2026
Merged

rbright merged 1 commit into
mainfrom
feature/gitleaks-full-history-scans

Conversation

@rbright

@rbright rbright commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

References

  • Security Bot gitleaks audit, 2026-11-29, item 392 (MEDIUM): cli has no weekly full-history scan and no full scan on a pin change.
  • Shape and names copied from agentgolf/analytics (gitleaks-history.yml, setup-gitleaks) and agentgolf/terraform (pin-change fallback).

What

  • .github/actions/setup-gitleaks/action.yml is now the only gitleaks pin (8.30.1 and SHA-256, unchanged).
  • New workflow gitleaks-history (job gitleaks-history) scans the full history every Monday at 06:17 UTC, on workflow_dispatch, and on a pull request or push to main that changes .gitleaks.toml or the pin.
  • The Gitleaks step of Repository checks still scans the commit range. It now scans the full history when the range changes .gitleaks.toml or the pin, and when the base commit is not in the clone.

Why

A new gitleaks rule or version never reached older commits, so a secret that only the new rules detect stayed unreported.

How to Review

Start with the Gitleaks step in repository-checks.yml, then gitleaks-history.yml. The scan stays in the Repository checks job, so the ruleset still requires it. No .gitleaks.toml is added: gitleaks reads it from the root when it exists and uses its default rules when not, so this PR works before and after Security Bot's config PR.

Verification

  • actionlint 1.7.12: no findings.
  • zizmor --offline .github 1.32.0: 0 medium or high, 2 low self-repository hints that match the ./ form of analytics.
  • Range-step logic in a scratch clone: pin change, zero SHA, and missing base give HEAD; other ranges give base..head.
  • gitleaks git --log-opts=HEAD 8.30.1 on the branch: no leaks.
  • Manual workflow_dispatch of gitleaks-history on this branch: run 46262275145, full history, no leaks.
  • PR runs: Repository checks logged the pin change and scanned HEAD; gitleaks-history ran through its path trigger. Both found no leaks.

- Move the gitleaks pin to the setup-gitleaks action and add the gitleaks-history workflow.
- A weekly cron, workflow_dispatch, and a change to .gitleaks.toml or the pin run the full scan.
- The range scan of Repository checks also falls back to the full history on a pin change.
@rbright
rbright requested a review from kthomas as a code owner November 29, 2026 12:26
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-29T12:27:05.805895Z 14f8c2b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@rbright rbright left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security review at 14f8c2b: no findings.

  • The gitleaks pin moves to .github/actions/setup-gitleaks and keeps the SHA-256 check before extraction.
  • The range step scans the full history (--log-opts=HEAD) when the base commit is not in the clone, and when the change touches .gitleaks.toml or the setup action. A PR measures from the merge base (...). A push measures before..sha, which is conservative after a force push. Event values reach the script only through env.
  • gitleaks-history scans --log-opts=HEAD with --redact on Mondays at 06:17Z, on dispatch, and on PRs and pushes that change the rules or the pin. It uses persist-credentials: false and contents: read. The repository is public, so --redact matters, and every scan keeps it.
  • repository-checks.yml has no concurrency group, so no push range is skipped.
  • Info: unlike uplink#7, the history workflow does not list its own file under paths, so an edit to it alone does not trigger a run. The weekly cron covers that.

@rbright
rbright merged commit ca9ae9f into main Nov 29, 2026
5 checks passed
@rbright
rbright deleted the feature/gitleaks-full-history-scans branch November 29, 2026 12:29
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