mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 12:44:22 +01:00
Merge pull request #141 from zricethezav/feature/default-all
removing branch from report
This commit is contained in:
2 files changed
+13
-18
No files matched your search
+10
-12
@@ -329,7 +329,6 @@ func TestWriteReport(t *testing.T) {
|
|||||||
Message: "get",
|
Message: "get",
|
||||||
Author: "some",
|
Author: "some",
|
||||||
File: "sleep",
|
File: "sleep",
|
||||||
Branch: "thxu",
|
|
||||||
Date: time.Now(),
|
Date: time.Now(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -444,17 +443,16 @@ func TestAuditRepo(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var tests = []struct {
|
var tests = []struct {
|
||||||
testOpts Options
|
testOpts Options
|
||||||
description string
|
description string
|
||||||
expectedErrMsg string
|
expectedErrMsg string
|
||||||
numLeaks int
|
numLeaks int
|
||||||
repo *RepoDescriptor
|
repo *RepoDescriptor
|
||||||
whiteListFiles []*regexp.Regexp
|
whiteListFiles []*regexp.Regexp
|
||||||
whiteListCommits map[string]bool
|
whiteListCommits map[string]bool
|
||||||
whiteListBranches []string
|
whiteListRepos []*regexp.Regexp
|
||||||
whiteListRepos []*regexp.Regexp
|
whiteListRegexes []*regexp.Regexp
|
||||||
whiteListRegexes []*regexp.Regexp
|
configPath string
|
||||||
configPath string
|
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
repo: leaksRepo,
|
repo: leaksRepo,
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ type Leak struct {
|
|||||||
Message string `json:"commitMsg"`
|
Message string `json:"commitMsg"`
|
||||||
Author string `json:"author"`
|
Author string `json:"author"`
|
||||||
File string `json:"file"`
|
File string `json:"file"`
|
||||||
Branch string `json:"branch"`
|
|
||||||
Repo string `json:"repo"`
|
Repo string `json:"repo"`
|
||||||
Date time.Time `json:"date"`
|
Date time.Time `json:"date"`
|
||||||
}
|
}
|
||||||
@@ -330,9 +329,9 @@ func writeReport(leaks []Leak) error {
|
|||||||
}
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
w := csv.NewWriter(f)
|
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 {
|
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()
|
w.Flush()
|
||||||
} else {
|
} else {
|
||||||
@@ -396,9 +395,7 @@ func cloneRepo() (*RepoDescriptor, error) {
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// auditGitRepo beings an audit on a git repository by checking the default HEAD branch, all branches, or
|
// auditGitRepo beings an audit on a git repository
|
||||||
// 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.
|
|
||||||
func auditGitRepo(repo *RepoDescriptor) ([]Leak, error) {
|
func auditGitRepo(repo *RepoDescriptor) ([]Leak, error) {
|
||||||
var (
|
var (
|
||||||
err error
|
err error
|
||||||
|
|||||||
Reference in new issue
Block a user