Explorar o código

Add pre-commit support (#552)

* Add pre-commit support

* Update README.md
Pavel Shklovsky %!s(int64=4) %!d(string=hai) anos
pai
achega
e7553b0168
Modificáronse 2 ficheiros con 18 adicións e 1 borrados
  1. 5 0
      .pre-commit-hooks.yaml
  2. 13 1
      README.md

+ 5 - 0
.pre-commit-hooks.yaml

@@ -0,0 +1,5 @@
+- id: gitleaks
+  name: Detect hardcoded secrets
+  description: Detect hardcoded secrets using Gitleaks
+  entry: gitleaks
+  language: golang

+ 13 - 1
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
 ```