---
title: "gitleaks git-history secret scan"
description: "Scans the full git history (all refs, newest settings[\"code.secrets-history\"].maxCommits, default 5000) with gitleaks for secrets that were committed and later removed. The repository is first copied into a bare mirror in a temp dir and scanned there with git config, hooks, attributes and textconv/fsmonitor drivers neutralised, so a hostile .git/config cannot execute code. Repositories whose git data reaches outside the target (an outside gitfile or commondir, alternates, symlinks in .git) are refused; replace refs, grafts and hidden refs cannot hide commits, and shallow or truncated history is reported as incomplete. The target's own .gitleaks.toml, .gitleaksignore and inline gitleaks:allow comments are deliberately ignored (a repository must not be able to allow-list its own leaks); gitleaks' built-in rules apply. Slow on large histories, so opt-in."
url: https://openaudit.se/auditors/code.secrets-history/
---

# gitleaks git-history secret scan

`code.secrets-history`

Scans the full git history (all refs, newest settings["code.secrets-history"].maxCommits, default 5000) with gitleaks for secrets that were committed and later removed. The repository is first copied into a bare mirror in a temp dir and scanned there with git config, hooks, attributes and textconv/fsmonitor drivers neutralised, so a hostile .git/config cannot execute code. Repositories whose git data reaches outside the target (an outside gitfile or commondir, alternates, symlinks in .git) are refused; replace refs, grafts and hidden refs cannot hide commits, and shallow or truncated history is reported as incomplete. The target's own .gitleaks.toml, .gitleaksignore and inline gitleaks:allow comments are deliberately ignored (a repository must not be able to allow-list its own leaks); gitleaks' built-in rules apply. Slow on large histories, so opt-in.

- **Engine:** Wrapped scanner
- **Wraps:** `gitleaks`
- **Targets:** Codebase
- **Areas:** Security
- **Runs:** Opt-in: only when selected with --only
- **Network:** Only the target itself

## Run only this auditor

```sh
bunx @openaudit/cli . --only code.secrets-history
```

Wraps gitleaks. When it isn't installed, the auditor is skipped with an install hint and the rest of the audit runs.

## More security auditors

- [Secrets in source](https://openaudit.se/auditors/code.secrets/) (`code.secrets`)
- [Static security analysis](https://openaudit.se/auditors/code.security/) (`code.security`)
- [Hidden Unicode](https://openaudit.se/auditors/code.unicode/) (`code.unicode`)
- [API definition and server configuration](https://openaudit.se/auditors/code.api/) (`code.api`)
- [AI agent configuration](https://openaudit.se/auditors/code.agent-config/) (`code.agent-config`)
- [gitleaks secret scan](https://openaudit.se/auditors/code.gitleaks/) (`code.gitleaks`)
- [Semgrep SAST](https://openaudit.se/auditors/code.semgrep/) (`code.semgrep`)
- [Trivy filesystem scan](https://openaudit.se/auditors/code.trivy-fs/) (`code.trivy-fs`)
