mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 13:14:22 +01:00
Add support for reportGroup (#456)
Why: * There are times where it would be nice to have a group from the regex reported rather than the complete match. This change addresses the need by: * Add the reportGroup configuration option for a rule. * Update scan.CheckRules to return the reportGroup if set. Co-authored-by: Daniel Paul Searles <dsearles@gitlab.com>
This commit is contained in:
1 parent
ede68fd95d
commit
2acc34dfdf
6 files changed
+158
No files matched your search
@@ -40,6 +40,7 @@ type Rule struct {
|
||||
Regex *regexp.Regexp
|
||||
File *regexp.Regexp
|
||||
Path *regexp.Regexp
|
||||
ReportGroup int
|
||||
Tags []string
|
||||
AllowList AllowList
|
||||
Entropies []Entropy
|
||||
@@ -73,6 +74,7 @@ type TomlLoader struct {
|
||||
Regex string
|
||||
File string
|
||||
Path string
|
||||
ReportGroup int
|
||||
Tags []string
|
||||
Entropies []struct {
|
||||
Min string
|
||||
@@ -198,6 +200,7 @@ func (tomlLoader TomlLoader) Parse() (Config, error) {
|
||||
Regex: re,
|
||||
File: fileNameRe,
|
||||
Path: filePathRe,
|
||||
ReportGroup: rule.ReportGroup,
|
||||
Tags: rule.Tags,
|
||||
AllowList: allowList,
|
||||
Entropies: entropies,
|
||||
|
||||
Reference in new issue
Block a user