mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-28 20:24:22 +01:00
* Add support in .gitleaksignore file comment strings (#1195) * Apply suggestions from code review Co-authored-by: Richard Gomez <32133502+rgmz@users.noreply.github.com> --------- Co-authored-by: Zachary Rice <zricezrice@gmail.com> Co-authored-by: Richard Gomez <32133502+rgmz@users.noreply.github.com>
This commit is contained in:
2 files changed
+6
-1
No files matched your search
+5
-1
@@ -149,7 +149,11 @@ func (d *Detector) AddGitleaksIgnore(gitleaksIgnorePath string) error {
|
||||
scanner := bufio.NewScanner(file)
|
||||
|
||||
for scanner.Scan() {
|
||||
d.gitleaksIgnore[scanner.Text()] = true
|
||||
line := strings.TrimSpace(scanner.Text())
|
||||
// Skip lines that start with a comment
|
||||
if line != "" && !strings.HasPrefix(line, "#") {
|
||||
d.gitleaksIgnore[line] = true
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Vendored
+1
@@ -1,2 +1,3 @@
|
||||
api/ignoreGlobal.go:aws-access-key:20
|
||||
# test comment
|
||||
53cd7a3c6eb4937f413e3c25e4a9f39289afa69e:api/ignoreCommit.go:aws-access-key:20
|
||||
Reference in new issue
Block a user