Compare commits

..
1 Commits
Author SHA1 Message Date
Zachary Rice 2ba97d0fa3 fixing audit repo bug (#101)
* fixing audit repo bug

* bumping version
2018-10-02 12:34:05 -05:00
3 changed files with 36 additions and 6 deletions

No files matched your search

+4
View File
@@ -1,6 +1,10 @@
CHANGELOG
=========
1.7.1
-----
- Fixing bug where single repos were not being audited
1.7.0
-----
- Exit code == 2 on error
+24
View File
@@ -239,6 +239,30 @@ func TestRunAudit(t *testing.T) {
numLeaks: 0,
expectedErrMsg: "unable to generate ssh key: open reallyreallyreallyreallywrongpath: no such file or directory",
},
{
testOpts: Options{
Repo: "https://github.com/gitleakstest/gronit.git",
},
description: "test leak",
numLeaks: 2,
expectedErrMsg: "",
},
{
testOpts: Options{
Repo: "https://github.com/gitleakstest/h1domains.git",
},
description: "test clean",
numLeaks: 0,
expectedErrMsg: "",
},
{
testOpts: Options{
Repo: "https://github.com/gitleakstest/empty.git",
},
description: "test empty",
numLeaks: 0,
expectedErrMsg: "reference not found",
},
}
g := goblin.Goblin(t)
for _, test := range tests {
+8 -6
View File
@@ -119,7 +119,7 @@ type Config struct {
}
const defaultGithubURL = "https://api.github.com/"
const version = "1.7.0"
const version = "1.7.1"
const errExit = 2
const leakExit = 1
const defaultConfig = `
@@ -194,10 +194,6 @@ func main() {
fmt.Println(version)
os.Exit(0)
}
if err != nil {
log.Error(err)
os.Exit(errExit)
}
leaks, err := run()
if err != nil {
log.Error(err)
@@ -245,7 +241,13 @@ func run() ([]Leak, error) {
func startAudits() ([]Leak, error) {
var leaks []Leak
// start audits
if opts.OwnerPath != "" {
if opts.Repo != "" || opts.RepoPath != "" {
repo, err := getRepo()
if err != nil {
return leaks, err
}
return auditRepo(repo)
} else if opts.OwnerPath != "" {
repos, err := discoverRepos(opts.OwnerPath)
if err != nil {
return leaks, err