mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 05:04:22 +01:00
Fixing merge commit scans and large patch rule checking (#414)
* Fixing merge commit scans and large patch rule checking * Adding tests for merge request scans
This commit is contained in:
1 parent
1dc7569f95
commit
eabc7b5c12
47 files changed
+278
-32
No files matched your search
@@ -200,7 +200,15 @@ func extractAndInjectLineNumber(leak *manager.Leak, bundle *Bundle, repo *Repo)
|
||||
if bundle.Patch == "" {
|
||||
return
|
||||
}
|
||||
|
||||
// This is needed as some patches generate strings that are larger than
|
||||
// scanners max size (MaxScanTokenSize = 64 * 1024)
|
||||
// https://github.com/zricethezav/gitleaks/issues/413
|
||||
buf := make([]byte, len(bundle.Patch))
|
||||
scanner := bufio.NewScanner(strings.NewReader(bundle.Patch))
|
||||
scanner.Buffer(buf, len(bundle.Patch))
|
||||
scanner.Split(bufio.ScanLines)
|
||||
|
||||
currFile := ""
|
||||
currLine := 0
|
||||
currStartDiffLine := 0
|
||||
|
||||
Reference in new issue
Block a user