updating changelog, readme, some other things

This commit is contained in:
zach rice committed 2018-10-20 17:16:35 -05:00
1 parent a998ddc9d4
commit 23489f3f18
4 files changed
+28 -3

No files matched your search

+1
View File
@@ -4,6 +4,7 @@ CHANGELOG
1.13.0
----
- Github PR support
- Github has its own go file. All other services, bitbucket, gitlab, etc should follow this convention
1.12.1
----
+1
View File
@@ -29,6 +29,7 @@ Application Options:
--github-user= Github user to audit
--github-org= Github organization to audit
--github-url= GitHub API Base URL, use for GitHub Enterprise. Example: https://github.example.com/api/v3/ (default: https://api.github.com/)
--github-pr= Github PR url to audit. This does not clone the repo. GITHUB_TOKEN must be set
-p, --private Include private repos in audit
-b, --branch= branch name to audit (defaults to HEAD)
-c, --commit= sha of commit to stop at
+22
View File
@@ -198,6 +198,7 @@ func TestRun(t *testing.T) {
whiteListRepos []string
numLeaks int
configPath string
commitPerPage int
}{
{
testOpts: Options{
@@ -293,6 +294,23 @@ func TestRun(t *testing.T) {
numLeaks: 0,
expectedErrMsg: "",
},
{
testOpts: Options{
GithubPR: "https://github.com/gitleakstest/gronit/pull/1",
},
description: "test github pr",
numLeaks: 4,
expectedErrMsg: "",
},
{
testOpts: Options{
GithubPR: "https://github.com/gitleakstest/gronit/pull/1",
},
description: "test github pr",
numLeaks: 4,
expectedErrMsg: "",
commitPerPage: 1,
},
}
g := goblin.Goblin(t)
for _, test := range tests {
@@ -301,12 +319,16 @@ func TestRun(t *testing.T) {
if test.configPath != "" {
os.Setenv("GITLEAKS_CONFIG", test.configPath)
}
if test.commitPerPage != 0 {
githubPages = test.commitPerPage
}
opts = test.testOpts
leaks, err := run()
if err != nil {
g.Assert(err.Error()).Equal(test.expectedErrMsg)
}
g.Assert(len(leaks)).Equal(test.numLeaks)
githubPages = 100
})
})
}
+4 -3
View File
@@ -63,7 +63,7 @@ type Options struct {
GithubUser string `long:"github-user" description:"Github user to audit"`
GithubOrg string `long:"github-org" description:"Github organization to audit"`
GithubURL string `long:"github-url" default:"https://api.github.com/" description:"GitHub API Base URL, use for GitHub Enterprise. Example: https://github.example.com/api/v3/"`
GithubPR string `long:"github-pr" description:"Github PR number to audit. This does not clone the repo."`
GithubPR string `long:"github-pr" description:"Github PR url to audit. This does not clone the repo. GITHUB_TOKEN must be set"`
IncludePrivate bool `short:"p" long:"private" description:"Include private repos in audit"`
/*
@@ -240,10 +240,11 @@ func main() {
if opts.Report != "" {
writeReport(leaks)
}
log.Infof("%d commits inspected in %s", totalCommits, durafmt.Parse(time.Now().Sub(now)).String())
if len(leaks) != 0 {
log.Warnf("%d leaks detected", len(leaks))
log.Warnf("%d leaks detected. %d commits inspected in %s", len(leaks), totalCommits, durafmt.Parse(time.Now().Sub(now)).String())
os.Exit(leakExit)
} else {
log.Infof("%d leaks detected. %d commits inspected in %s", len(leaks), totalCommits, durafmt.Parse(time.Now().Sub(now)).String())
}
}