mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 12:44:22 +01:00
feat(config): define multiple global allowlists (#1777)
This commit is contained in:
1 parent
7fb21a4e61
commit
4451b455f3
60 files changed
+1214
-843
No files matched your search
Vendored
+2
-2
@@ -1,10 +1,10 @@
|
||||
title = "gitleaks config"
|
||||
|
||||
[[rules]]
|
||||
description = "Generic API Key"
|
||||
id = "generic-api-key"
|
||||
description = "Generic API Key"
|
||||
regex = '''(?i)(?:key|api|token|secret|client|passwd|password|auth|access)(?:[0-9a-z\-_\t .]{0,20})(?:[\s|']|[\s|"]){0,3}(?:=|>|:{1,3}=|\|\|:|<=|=>|:|\?=)(?:'|\"|\s|=|\x60){0,5}([0-9a-z\-_.=]{10,150})(?:['|\"|\n|\r|\s|\x60|;]|$)'''
|
||||
entropy = 3.5
|
||||
keywords = [
|
||||
"key","api","token","secret","client","passwd","password","auth","access",
|
||||
]
|
||||
]
|
||||
+8
-9
@@ -1,15 +1,20 @@
|
||||
title = "gitleaks config"
|
||||
|
||||
[[rules]]
|
||||
description = "Generic API Key"
|
||||
id = "generic-api-key"
|
||||
regex = '''(?i)((key|api|token|secret|password)[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9a-zA-Z\-_=]{8,64})['\"]'''
|
||||
description = "Generic API Key"
|
||||
path = '''.py'''
|
||||
entropy = 3.7
|
||||
regex = '''(?i)((key|api|token|secret|password)[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|:|<=|=>|:).{0,5}['\"]([0-9a-zA-Z\-_=]{8,64})['\"]'''
|
||||
secretGroup = 4
|
||||
entropy = 3.7
|
||||
|
||||
[allowlist]
|
||||
description = "global allow lists"
|
||||
paths = [
|
||||
'''gitleaks.toml''',
|
||||
'''(.*?)(jpg|gif|doc|pdf|bin|svg|socket)$''',
|
||||
'''(go.mod|go.sum)$'''
|
||||
]
|
||||
regexes = [
|
||||
'''219-09-9999''',
|
||||
'''078-05-1120''',
|
||||
@@ -27,10 +32,4 @@ regexes = [
|
||||
'''api\_key''',
|
||||
'''apikey''',
|
||||
'''api\-key''',
|
||||
]
|
||||
paths = [
|
||||
'''gitleaks.toml''',
|
||||
'''(.*?)(jpg|gif|doc|pdf|bin|svg|socket)$''',
|
||||
'''(go.mod|go.sum)$'''
|
||||
]
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
[[allowlists]]
|
||||
@@ -0,0 +1,4 @@
|
||||
[allowlist]
|
||||
regexes = ['''123''']
|
||||
[[allowlists]]
|
||||
regexes = ['''456''']
|
||||
@@ -0,0 +1,3 @@
|
||||
[[allowlists]]
|
||||
regexTarget = "mtach"
|
||||
regexes = ['''456''']
|
||||
@@ -0,0 +1,7 @@
|
||||
[[rules]]
|
||||
id = "github-app-token"
|
||||
regex = '''(?:ghu|ghs)_[0-9a-zA-Z]{36}'''
|
||||
|
||||
[[allowlists]]
|
||||
targetRules = ["github-app-token", "github-pat"]
|
||||
regexes = ['''.*fake.*''']
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
title = "simple config with allowlist for aws"
|
||||
|
||||
[[rules]]
|
||||
id = "example"
|
||||
regex = '''example\d+'''
|
||||
-2
@@ -1,5 +1,3 @@
|
||||
title = "simple config with allowlist for aws"
|
||||
|
||||
[[rules]]
|
||||
id = "example"
|
||||
regex = '''example\d+'''
|
||||
-2
@@ -1,5 +1,3 @@
|
||||
title = "simple config with allowlist for aws"
|
||||
|
||||
[[rules]]
|
||||
id = "example"
|
||||
regex = '''example\d+'''
|
||||
Vendored
+5
-3
@@ -1,8 +1,10 @@
|
||||
title = "gitleaks extended 1"
|
||||
|
||||
[extend]
|
||||
path="../testdata/config/invalid/does_not_exist.toml"
|
||||
|
||||
[[rules]]
|
||||
description = "AWS Access Key"
|
||||
id = "aws-access-key"
|
||||
regex = '''(?:A3T[A-Z0-9]|AKIA|ASIA|ABIA|ACCA)[A-Z0-9]{16}'''
|
||||
tags = ["key", "AWS"]
|
||||
|
||||
[allowlist]
|
||||
regexes = ['''AKIALALEMEL33243OLIA''']
|
||||
Vendored
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,10 @@
|
||||
[[rules]]
|
||||
id = "test"
|
||||
regex = '''token = "(.+)"'''
|
||||
|
||||
[[allowlists]]
|
||||
regexes = ["^changeit$"]
|
||||
[[allowlists]]
|
||||
condition = "AND"
|
||||
paths = ["^node_modules/.*"]
|
||||
stopwords = ["mock"]
|
||||
@@ -0,0 +1,2 @@
|
||||
[allowlist]
|
||||
stopwords = ["0989c462-69c9-49fa-b7d2-30dc5c576a97"]
|
||||
@@ -0,0 +1,2 @@
|
||||
[allowlist]
|
||||
regexes = ['''AKIALALEM.L33243OLIA''']
|
||||
@@ -0,0 +1,20 @@
|
||||
[[rules]]
|
||||
id = "github-app-token"
|
||||
regex = '''(?:ghu|ghs)_[0-9a-zA-Z]{36}'''
|
||||
|
||||
[[rules]]
|
||||
id = "github-oauth"
|
||||
regex = '''gho_[0-9a-zA-Z]{36}'''
|
||||
|
||||
[[rules]]
|
||||
id = "github-pat"
|
||||
regex = '''ghp_[0-9a-zA-Z]{36}'''
|
||||
|
||||
|
||||
[[allowlists]]
|
||||
regexes = ['''.*fake.*''']
|
||||
[[allowlists]]
|
||||
targetRules = ["github-app-token", "github-pat"]
|
||||
paths = [
|
||||
'''(?:^|/)@octokit/auth-token/README\.md$''',
|
||||
]
|
||||
File renamed without changes.
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
title = "simple config with allowlist for aws"
|
||||
|
||||
[[rules]]
|
||||
id = "example"
|
||||
regex = '''example\d+'''
|
||||
File renamed without changes.
File renamed without changes.
@@ -1,7 +1,5 @@
|
||||
title = "gitleaks config"
|
||||
|
||||
[extend]
|
||||
path="../testdata/config/extend_1.toml"
|
||||
path="../testdata/config/valid/extend_base_1.toml"
|
||||
|
||||
[[rules]]
|
||||
description = "AWS Secret Key"
|
||||
@@ -1,7 +1,7 @@
|
||||
title = "gitleaks extended 1"
|
||||
|
||||
[extend]
|
||||
path="../testdata/config/extend_2.toml"
|
||||
path="../testdata/config/valid/extend_base_2.toml"
|
||||
|
||||
[[rules]]
|
||||
description = "AWS Access Key"
|
||||
File renamed without changes.
File renamed without changes.
+1
-1
@@ -1,7 +1,7 @@
|
||||
title = "gitleaks extended 3"
|
||||
|
||||
[extend]
|
||||
path="../testdata/config/extend_rule_keywords_base.toml"
|
||||
path="../testdata/config/valid/extend_rule_keywords_base.toml"
|
||||
|
||||
[[rules]]
|
||||
id = "aws-secret-key-again-again"
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
title = "gitleaks extend disable"
|
||||
|
||||
[extend]
|
||||
path = "../testdata/config/extend_disabled_base.toml"
|
||||
path = "../testdata/config/valid/extend_disabled_base.toml"
|
||||
disabledRules = [
|
||||
'custom-rule1'
|
||||
]
|
||||
Vendored
File renamed without changes.
+1
-1
@@ -1,7 +1,7 @@
|
||||
title = "gitleaks extended 3"
|
||||
|
||||
[extend]
|
||||
path="../testdata/config/extend_rule_allowlist_base.toml"
|
||||
path="../testdata/config/valid/extend_rule_allowlist_base.toml"
|
||||
|
||||
[[rules]]
|
||||
id = "aws-secret-key-again-again"
|
||||
File renamed without changes.
Vendored
+1
-1
@@ -1,7 +1,7 @@
|
||||
title = "gitleaks extended 3"
|
||||
|
||||
[extend]
|
||||
path="../testdata/config/extend_rule_allowlist_base.toml"
|
||||
path="../testdata/config/valid/extend_rule_allowlist_base.toml"
|
||||
|
||||
[[rules]]
|
||||
id = "aws-secret-key-again-again"
|
||||
File renamed without changes.
+1
-1
@@ -1,7 +1,7 @@
|
||||
title = "gitleaks extended 3"
|
||||
|
||||
[extend]
|
||||
path="../testdata/config/extend_rule_keywords_base.toml"
|
||||
path="../testdata/config/valid/extend_rule_keywords_base.toml"
|
||||
|
||||
[[rules]]
|
||||
id = "aws-rule-that-is-not-in-base"
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
[extend]
|
||||
path="../testdata/config/extend_3.toml"
|
||||
path="../testdata/config/valid/extend_base_3.toml"
|
||||
|
||||
[[rules]]
|
||||
id = "aws-secret-key-again-again"
|
||||
File renamed without changes.
Vendored
File renamed without changes.
Vendored
File renamed without changes.
File renamed without changes.
Vendored
File renamed without changes.
File renamed without changes.
File renamed without changes.
-2
@@ -1,5 +1,3 @@
|
||||
title = "gitleaks config"
|
||||
|
||||
[[rules]]
|
||||
id = "discord-api-key"
|
||||
description = "Discord API key"
|
||||
@@ -1,5 +1,3 @@
|
||||
title = "gitleaks config"
|
||||
|
||||
[[rules]]
|
||||
description = "Python Files"
|
||||
id = "python-files-only"
|
||||
+1
-4
@@ -1,8 +1,5 @@
|
||||
title = "gitleaks config"
|
||||
# https://learnxinyminutes.com/docs/toml/ for toml reference
|
||||
|
||||
[[rules]]
|
||||
id = "pypi-upload-token"
|
||||
description = "PyPI upload token"
|
||||
regex = '''pypi-AgEIcHlwaS5vcmc[A-Za-z0-9\-_]{50,1000}'''
|
||||
tags = ["key", "pypi"]
|
||||
tags = ["key", "pypi"]
|
||||
Reference in new issue
Block a user