- Checks a git diff for passwords/secret keys accidentally committed
- Golang 1.7+
$ git log -p | diffence
$ git log -p --full-diff | diffence
------------------
Violation 1
Commit: 4cc087a1b4731d1017844cc86323df43068b0409
File: web/src/db/seed.sql
Reason: "SQL dump file"
------------------
Violation 2
Commit: 142e6019248c0d53a5240242ed1a75c0cc110a0b
File: config/passwords.ini
Reason: "Contains word: password"
$ cat .secignore
file/that/is/not/really/a/secret/but/looks/like/one/to/diffence
these/pems/are/ok/*.pem
Download the latest stable release.
$ go get -u github.com/techjacker/diffence/cmd/diffence
$ go get -u github.com/techjacker/diffence
$ touch key.pem
$ git add -N key.pem
$ git diff --stat HEAD
gds HEAD
key.pem | 0
1 file changed, 0 insertions(+), 0 deletions(-)
$ git diff HEAD |diffence
File key.pem violates 1 rules:
Caption: Potential cryptographic private key
Description: <nil>
Part: extension
Pattern: pem
Type: match
- Analyse fPaths with gitrob rules
- Analyse added lines - need to find/create ruleset that can analyse file contents
- Add option to use your own rules again file path/contents
$ go test ./...
$ go install -race ./cmd/diffence
OR
$ go build -race ./cmd/diffence
$ go run -race ./cmd/diffence/main.go