mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 12:44:22 +01:00
Adding global file regex to AuditUncommitted
This commit is contained in:
1 parent
9b3342fbff
commit
c04e137b28
1 file changed
+12
@@ -157,6 +157,18 @@ func (repo *Repo) AuditUncommitted() error {
|
|||||||
|
|
||||||
if fileMatched(filename, repo.config.Whitelist.File) {
|
if fileMatched(filename, repo.config.Whitelist.File) {
|
||||||
log.Debugf("whitelisted file found, skipping audit of file: %s", filename)
|
log.Debugf("whitelisted file found, skipping audit of file: %s", filename)
|
||||||
|
} else if fileMatched(filename, repo.config.FileRegex) {
|
||||||
|
repo.Manager.SendLeaks(manager.Leak{
|
||||||
|
Line: "N/A",
|
||||||
|
Offender: filename,
|
||||||
|
Commit: c.Hash.String(),
|
||||||
|
Repo: repo.Name,
|
||||||
|
Rule: "file regex matched" + repo.config.FileRegex.String(),
|
||||||
|
Author: c.Author.Name,
|
||||||
|
Email: c.Author.Email,
|
||||||
|
Date: c.Author.When,
|
||||||
|
File: filename,
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
dmp := diffmatchpatch.New()
|
dmp := diffmatchpatch.New()
|
||||||
diffs := dmp.DiffMain(prevFileContents, currFileContents, false)
|
diffs := dmp.DiffMain(prevFileContents, currFileContents, false)
|
||||||
|
|||||||
Reference in new issue
Block a user