diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml new file mode 100644 index 00000000..f9b0a976 --- /dev/null +++ b/.pre-commit-hooks.yaml @@ -0,0 +1,5 @@ +- id: gitleaks + name: Detect hardcoded secrets + description: Detect hardcoded secrets using Gitleaks + entry: gitleaks + language: golang diff --git a/README.md b/README.md index 55c19832..ed530b70 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Gitleaks is a SAST tool for detecting hardcoded secrets like passwords, api keys ### Installation -Gitleaks can be installed using Homebrew, Docker, or Go. Gitleaks is also available in binary form for many popular platforms and OS types on the [releases page](https://github.com/zricethezav/gitleaks/releases). +Gitleaks can be installed using Homebrew, Docker, or Go. Gitleaks is also available in binary form for many popular platforms and OS types on the [releases page](https://github.com/zricethezav/gitleaks/releases). In addition, Gitleaks can be implemented as a pre-commit hook directly in your repo. ##### MacOS @@ -42,6 +42,18 @@ docker pull zricethezav/gitleaks ```bash GO111MODULE=on go get github.com/zricethezav/gitleaks/v7 ``` +##### As a pre-commit hook + +See [pre-commit](https://github.com/pre-commit/pre-commit) for instructions. + +Sample `.pre-commit-config.yaml` + +```yaml +- repo: https://github.com/zricethezav/gitleaks + rev: v7.4.0 + hooks: + - id: gitleaks +``` ### Usage and Options ```