Whitelist repo (#378)

* fixing commit latest bug

* bumping go-git and adding repo whitelist

* adding tests
This commit is contained in:
Zachary Rice authored and GitHub committed 2020-05-09 10:38:02 -04:00
1 parent 8bd4649b01
commit 473d0d55a7
12 files changed
+282 -65

No files matched your search

+6 -3
View File
@@ -11,9 +11,9 @@ import (
"github.com/jessevdk/go-flags"
log "github.com/sirupsen/logrus"
"gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/plumbing/transport/http"
"gopkg.in/src-d/go-git.v4/plumbing/transport/ssh"
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing/transport/http"
"github.com/go-git/go-git/v5/plumbing/transport/ssh"
)
// No leaks or early exit due to invalid options
@@ -110,6 +110,9 @@ func (opts Options) Guard() error {
if !oneOrNoneSet(opts.AccessToken, opts.Password) {
log.Warn("both access-token and password are set. Only password will be attempted")
}
if !oneOrNoneSet(opts.FilesAtCommit, opts.Commit, opts.CommitTo, opts.CommitFrom) {
return fmt.Errorf("invalid commit options set")
}
return nil
}