mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 12:44:22 +01:00
the smartest filter
This commit is contained in:
1 parent
5f737c311b
commit
6eaf12267b
3 files changed
+13
-10
No files matched your search
+6
-10
@@ -550,16 +550,6 @@ func (d *Detector) detectRule(fragment Fragment, currentRaw string, r config.Rul
|
||||
}
|
||||
}
|
||||
|
||||
// check if this is a generic rule
|
||||
if r.SmartFilter {
|
||||
if !d.passesSmartFilter(finding.Secret) {
|
||||
// logger.Info().
|
||||
// Str("finding", finding.Secret).
|
||||
// Msg("skipping finding: fails smart filter")
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
// check if the result matches any of the global allowlists.
|
||||
if isAllowed, event := checkFindingAllowed(logger, finding, fragment, currentLine, d.Config.Allowlists); isAllowed {
|
||||
event.Msg("skipping finding: global allowlist")
|
||||
@@ -571,6 +561,12 @@ func (d *Detector) detectRule(fragment Fragment, currentRaw string, r config.Rul
|
||||
event.Msg("skipping finding: rule allowlist")
|
||||
continue
|
||||
}
|
||||
|
||||
if r.SmartFilter {
|
||||
if !d.passesSmartFilter(finding.Secret) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
findings = append(findings, finding)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user