@b12k/gitleaks
v8.30.1-v.24
Published
The missing NPM wrapper for Gitleaks
Maintainers
Readme
The missing npm wrapper for Gitleaks
Gitleaks - is a fast, lightweight secret scanner for git repositories.
This library is just a thin wrapper which automatically downloads the correct gitleaks binary for your platform on install and exposes it as a CLI command.
Installation
Typically installed as a dev dependency:
Local (project)
npm install --save-dev @b12k/gitleaksRecent npm versions require approving dependency install scripts. Approve this package so its postinstall script can download the gitleaks binary:
npm approve-scripts @b12k/gitleakspnpm add -D --allow-build=@b12k/gitleaks @b12k/gitleakspnpm 11 requires the --allow-build flag so this package's postinstall script can download the gitleaks binary.
yarn add --dev @b12k/gitleaksGlobal
npm install -g --allow-scripts=@b12k/gitleaks @b12k/gitleaksGlobal npm installs cannot use npm approve-scripts; use --allow-scripts instead.
pnpm add -g --allow-build=@b12k/gitleaks @b12k/gitleakspnpm 11 requires the --allow-build flag during global install as well.
yarn global add @b12k/gitleaksThe postinstall script downloads the gitleaks binary for your platform from the official GitHub release.
If you already installed with npm or pnpm and the build was blocked, approve and rebuild it:
npm approve-scripts @b12k/gitleaks
npm rebuild @b12k/gitleakspnpm approve-builds @b12k/gitleaks
pnpm rebuild @b12k/gitleaksUsage
See the gitleaks documentation for the full list of commands and flags.
Local install
npx gitleaks <command>pnpm exec gitleaks <command>yarn gitleaks <command>Global install
gitleaks <command>package.json script
{ "scripts": { "secrets": "gitleaks <command>" } }Troubleshooting
If the binary fails to install, re-run with --foreground-scripts to see the postinstall output:
npm install --save-dev @b12k/gitleaks --foreground-scriptspnpm add -D --allow-build=@b12k/gitleaks @b12k/gitleaks --foreground-scriptsyarn add --dev @b12k/gitleaks --foreground-scriptsSupported platforms
- Linux — x64, arm64
- macOS — x64, arm64
- Windows — x64, arm64
Version
The npm package version mirrors the gitleaks release version.
To install a different gitleaks release, define it in .gitleaks-version as v1.2.3 or 1.2.3 before installing the package.
If you add or change .gitleaks-version after installing, run:
gitleaks-install