mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 13:14:22 +01:00
Ensure keywords are downcased (#1633)
* Ensure keywords are downcased * Update tests * Remove unnecessary code * Add msg to test expectation * Update the keywords as we iterate through them * Remove unnecessary to lower --------- Co-authored-by: Craig Smith <5344211-craigmsmith@users.noreply.gitlab.com>
This commit is contained in:
1 parent
f6966057f5
commit
2f73a3e3cf
5 files changed
+74
-5
No files matched your search
+4
-5
@@ -93,8 +93,10 @@ func (vc *ViperConfig) Translate() (Config, error) {
|
||||
if vr.Keywords == nil {
|
||||
vr.Keywords = []string{}
|
||||
} else {
|
||||
for _, k := range vr.Keywords {
|
||||
keywords[strings.ToLower(k)] = struct{}{}
|
||||
for i, k := range vr.Keywords {
|
||||
keyword := strings.ToLower(k)
|
||||
keywords[keyword] = struct{}{}
|
||||
vr.Keywords[i] = keyword
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,9 +318,6 @@ func (c *Config) extend(extensionConfig Config) {
|
||||
for _, k := range baseRule.Keywords {
|
||||
c.Keywords[k] = struct{}{}
|
||||
}
|
||||
for _, k := range currentRule.Keywords {
|
||||
c.Keywords[k] = struct{}{}
|
||||
}
|
||||
c.Rules[ruleID] = baseRule
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user