From 40240cb5ee2d38dcc15b18c986f9127c14c10bca Mon Sep 17 00:00:00 2001 From: zach rice Date: Sat, 3 Nov 2018 11:31:18 -0500 Subject: [PATCH 1/2] removing branch from report --- main.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index dd4b0718..dc0da885 100644 --- a/main.go +++ b/main.go @@ -44,7 +44,6 @@ type Leak struct { Message string `json:"commitMsg"` Author string `json:"author"` File string `json:"file"` - Branch string `json:"branch"` Repo string `json:"repo"` Date time.Time `json:"date"` } @@ -330,9 +329,9 @@ func writeReport(leaks []Leak) error { } defer f.Close() w := csv.NewWriter(f) - w.Write([]string{"repo", "line", "commit", "offender", "reason", "commitMsg", "author", "file", "branch", "date"}) + w.Write([]string{"repo", "line", "commit", "offender", "reason", "commitMsg", "author", "file", "date"}) for _, leak := range leaks { - w.Write([]string{leak.Repo, leak.Line, leak.Commit, leak.Offender, leak.Type, leak.Message, leak.Author, leak.File, leak.Branch, leak.Date.Format(time.RFC3339)}) + w.Write([]string{leak.Repo, leak.Line, leak.Commit, leak.Offender, leak.Type, leak.Message, leak.Author, leak.File, leak.Date.Format(time.RFC3339)}) } w.Flush() } else { @@ -396,9 +395,7 @@ func cloneRepo() (*RepoDescriptor, error) { }, nil } -// auditGitRepo beings an audit on a git repository by checking the default HEAD branch, all branches, or -// a single branch depending on what gitleaks is configured to do. Note when I say branch I really -// mean reference as these branches are read only. +// auditGitRepo beings an audit on a git repository func auditGitRepo(repo *RepoDescriptor) ([]Leak, error) { var ( err error From ba49396755b08ed319871824b0feb4c51d3230e7 Mon Sep 17 00:00:00 2001 From: zach rice Date: Sat, 3 Nov 2018 11:34:07 -0500 Subject: [PATCH 2/2] updating tests --- gitleaks_test.go | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/gitleaks_test.go b/gitleaks_test.go index 6926761e..582848df 100644 --- a/gitleaks_test.go +++ b/gitleaks_test.go @@ -329,7 +329,6 @@ func TestWriteReport(t *testing.T) { Message: "get", Author: "some", File: "sleep", - Branch: "thxu", Date: time.Now(), }, } @@ -444,17 +443,16 @@ func TestAuditRepo(t *testing.T) { } var tests = []struct { - testOpts Options - description string - expectedErrMsg string - numLeaks int - repo *RepoDescriptor - whiteListFiles []*regexp.Regexp - whiteListCommits map[string]bool - whiteListBranches []string - whiteListRepos []*regexp.Regexp - whiteListRegexes []*regexp.Regexp - configPath string + testOpts Options + description string + expectedErrMsg string + numLeaks int + repo *RepoDescriptor + whiteListFiles []*regexp.Regexp + whiteListCommits map[string]bool + whiteListRepos []*regexp.Regexp + whiteListRegexes []*regexp.Regexp + configPath string }{ { repo: leaksRepo,