mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 12:44:22 +01:00
Fix rule extension (#1556)
* Reimplement the ability to override built-in rules PR #1524 broke the ability to specify a `[[rules]]` with the same ID as a built-in rule in order to extend the default configuration. This PR restores this ability, but merges the provided configuration with the default rule instead of overwriting the default rule wholesale. * Add tests * Append keywords and tags
This commit is contained in:
1 parent
9988e5224c
commit
be9d0f8930
9 files changed
+190
-2
No files matched your search
+8
@@ -0,0 +1,8 @@
|
||||
title = "override a built-in rule's description"
|
||||
|
||||
[extend]
|
||||
path = "../testdata/config/simple.toml"
|
||||
|
||||
[[rules]]
|
||||
id = "aws-access-key"
|
||||
description = "Puppy Doggy"
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
title = "override a built-in rule's entropy"
|
||||
|
||||
[extend]
|
||||
path = "../testdata/config/simple.toml"
|
||||
|
||||
[[rules]]
|
||||
id = "aws-access-key"
|
||||
entropy = 999
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
title = "override a built-in rule's keywords"
|
||||
|
||||
[extend]
|
||||
path = "../testdata/config/simple.toml"
|
||||
|
||||
[[rules]]
|
||||
id = "aws-access-key"
|
||||
keywords = ["puppy"]
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
title = "override a built-in rule's path"
|
||||
|
||||
[extend]
|
||||
path = "../testdata/config/simple.toml"
|
||||
|
||||
[[rules]]
|
||||
id = "aws-access-key"
|
||||
path = '''(?:puppy)'''
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
title = "override a built-in rule's regex"
|
||||
|
||||
[extend]
|
||||
path = "../testdata/config/simple.toml"
|
||||
|
||||
[[rules]]
|
||||
id = "aws-access-key"
|
||||
regex = '''(?:a)'''
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
title = "override a built-in rule's secretGroup"
|
||||
|
||||
[extend]
|
||||
path = "../testdata/config/simple.toml"
|
||||
|
||||
[[rules]]
|
||||
id = "aws-access-key"
|
||||
regex = '''(?:a)(?:a)'''
|
||||
secretGroup = 2
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
title = "override a built-in rule's tags"
|
||||
|
||||
[extend]
|
||||
path = "../testdata/config/simple.toml"
|
||||
|
||||
[[rules]]
|
||||
id = "aws-access-key"
|
||||
tags = ["puppy"]
|
||||
Reference in new issue
Block a user