From c04e137b280e4da4e5fc0decb2b88eaa7c738537 Mon Sep 17 00:00:00 2001 From: Peter Gallagher Date: Thu, 28 Nov 2019 22:53:08 +0000 Subject: [PATCH] Adding global file regex to AuditUncommitted --- audit/repo.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/audit/repo.go b/audit/repo.go index bcea1f50..68dfc27b 100644 --- a/audit/repo.go +++ b/audit/repo.go @@ -157,6 +157,18 @@ func (repo *Repo) AuditUncommitted() error { if fileMatched(filename, repo.config.Whitelist.File) { 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 { dmp := diffmatchpatch.New() diffs := dmp.DiffMain(prevFileContents, currFileContents, false)