|
@@ -384,6 +384,7 @@ MatchLoop:
|
|
|
|
|
|
|
|
// For any meta data from decoding
|
|
// For any meta data from decoding
|
|
|
var metaTags []string
|
|
var metaTags []string
|
|
|
|
|
+ currentLine := ""
|
|
|
|
|
|
|
|
// Check if the decoded portions of the segment overlap with the match
|
|
// Check if the decoded portions of the segment overlap with the match
|
|
|
// to see if its potentially a new match
|
|
// to see if its potentially a new match
|
|
@@ -391,6 +392,7 @@ MatchLoop:
|
|
|
if segment := segmentWithDecodedOverlap(encodedSegments, matchIndex[0], matchIndex[1]); segment != nil {
|
|
if segment := segmentWithDecodedOverlap(encodedSegments, matchIndex[0], matchIndex[1]); segment != nil {
|
|
|
matchIndex = segment.adjustMatchIndex(matchIndex)
|
|
matchIndex = segment.adjustMatchIndex(matchIndex)
|
|
|
metaTags = append(metaTags, segment.tags()...)
|
|
metaTags = append(metaTags, segment.tags()...)
|
|
|
|
|
+ currentLine = currentRaw[segment.lineStartIndex(currentRaw):segment.lineEndIndex(currentRaw, matchIndex[1]-matchIndex[0])]
|
|
|
} else {
|
|
} else {
|
|
|
// This item has already been added to a finding
|
|
// This item has already been added to a finding
|
|
|
continue
|
|
continue
|
|
@@ -433,6 +435,10 @@ MatchLoop:
|
|
|
continue
|
|
continue
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if currentLine == "" {
|
|
|
|
|
+ currentLine = finding.Line
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// Set the value of |secret|, if the pattern contains at least one capture group.
|
|
// Set the value of |secret|, if the pattern contains at least one capture group.
|
|
|
// (The first element is the full match, hence we check >= 2.)
|
|
// (The first element is the full match, hence we check >= 2.)
|
|
|
groups := r.Regex.FindStringSubmatch(finding.Secret)
|
|
groups := r.Regex.FindStringSubmatch(finding.Secret)
|
|
@@ -474,7 +480,7 @@ MatchLoop:
|
|
|
case "match":
|
|
case "match":
|
|
|
globalAllowlistTarget = finding.Match
|
|
globalAllowlistTarget = finding.Match
|
|
|
case "line":
|
|
case "line":
|
|
|
- globalAllowlistTarget = finding.Line
|
|
|
|
|
|
|
+ globalAllowlistTarget = currentLine
|
|
|
}
|
|
}
|
|
|
if d.Config.Allowlist.RegexAllowed(globalAllowlistTarget) {
|
|
if d.Config.Allowlist.RegexAllowed(globalAllowlistTarget) {
|
|
|
logger.Trace().
|
|
logger.Trace().
|
|
@@ -496,7 +502,7 @@ MatchLoop:
|
|
|
case "match":
|
|
case "match":
|
|
|
allowlistTarget = finding.Match
|
|
allowlistTarget = finding.Match
|
|
|
case "line":
|
|
case "line":
|
|
|
- allowlistTarget = finding.Line
|
|
|
|
|
|
|
+ allowlistTarget = currentLine
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
var (
|
|
var (
|