Add file regex support (#340)

* Modified Entropy to be able to apply it on regex match or specific capture group

* Config tests

* Small fixes on entropy ranges

* Fix toml configs
Fix tests

* Start adding support for rules with filename regex

Changed how config is parsed
Created new functions to inspect files and content

* File regex working

* Fixing tests and configs

* Implemented different regex for filename and filepath

* Fix comments

* Audit tests

* Config rename vars

* Fix audit tests

* Filename offender

* Indents and code styles

* Indents and code styles

* Removing bad test repo

* Adding test repo 6 for filename and filepath tests

* global whitelist path and fixes

* Fixes on tests and new test for global whitelisting paths

* Removing unused test

* Fix comment
This commit is contained in:
Noel Algora authored and GitHub committed 2020-02-26 15:33:14 -05:00
1 parent 01d73028f8
commit c4b07f5113
71 files changed
+556 -256

No files matched your search

+2 -1
View File
@@ -160,7 +160,8 @@ title = "gitleaks config"
Min = "5.2"
Max = "5.5"
[Global]
[[rules]]
description = "Files with keys and credentials"
file = '''(?i)(id_rsa|passwd|id_rsa.pub|pgpass|pem|key|shadow)'''
[whitelist]
+3 -1
View File
@@ -6,5 +6,7 @@
regex = '''(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}'''
tags = ["key", "AWS"]
[Global]
[[rules]]
description = "PEM Files"
file = '''(.*)?pem$'''
tags = ["key", "PEM"]