mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 12:44:22 +01:00
Bugfix/1352 incorrect report multiple lines (#1501)
* fix: add logic to modify endline & endcolumn * doc: update comment for #1352 * test: adding test file * chore: updating generic rule * test: adding test to TestFromFile #1352 & change static viper ConfigName * chore: remove interim fix for #1352 * fix: adjust matchIndex[1] to fix #1352 * test: adjust expectedFinding in TestFromFiles * chore: go fmt * test: rm identification of start/endlineIndex * fix: rm unused fmt pkg
This commit is contained in:
1 parent
ed19c4e8b4
commit
f8dcd838da
5 files changed
+38
-4
No files matched your search
@@ -265,6 +265,10 @@ func (d *Detector) detectRule(fragment Fragment, rule config.Rule) []report.Find
|
||||
// extract secret from match
|
||||
secret := strings.Trim(fragment.Raw[matchIndex[0]:matchIndex[1]], "\n")
|
||||
|
||||
// Fixes: https://github.com/gitleaks/gitleaks/issues/1352
|
||||
// removes the incorrectly following line that was detected by regex expression '\n'
|
||||
matchIndex[1] = matchIndex[0] + len(secret)
|
||||
|
||||
// determine location of match. Note that the location
|
||||
// in the finding will be the line/column numbers of the _match_
|
||||
// not the _secret_, which will be different if the secretGroup
|
||||
|
||||
Reference in new issue
Block a user