mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-28 12:14:22 +01:00
bumping version, format, changelog, uhhhhhh, test... a single test
This commit is contained in:
1 parent
4aa7be2dbf
commit
793bbc793f
4 files changed
+22
-11
No files matched your search
@@ -1,6 +1,10 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
1.20.0
|
||||
----
|
||||
- adding gitlab user and group support
|
||||
|
||||
1.19.3
|
||||
----
|
||||
- memoizing root commit
|
||||
|
||||
@@ -19,12 +19,13 @@ const gitlabPages = 100
|
||||
// that error is logged.
|
||||
func auditGitlabRepos() ([]Leak, error) {
|
||||
var (
|
||||
ps []*gitlab.Project
|
||||
resp *gitlab.Response
|
||||
err error
|
||||
ps []*gitlab.Project
|
||||
resp *gitlab.Response
|
||||
leaks []Leak
|
||||
tempDir string
|
||||
err error
|
||||
)
|
||||
|
||||
leaks := make([]Leak, 0)
|
||||
repos := make([]*gitlab.Project, 0, gitlabPages)
|
||||
page := 1
|
||||
cl := gitlab.NewClient(nil, os.Getenv("GITLAB_TOKEN"))
|
||||
@@ -70,15 +71,12 @@ func auditGitlabRepos() ([]Leak, error) {
|
||||
|
||||
log.Debugf("found projects: %d", len(repos))
|
||||
|
||||
var tempDir string
|
||||
|
||||
if opts.Disk {
|
||||
if tempDir, err = createGitlabTempDir(); err != nil {
|
||||
log.Fatal("error creating temp directory: ", err)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: use goroutines?
|
||||
for _, p := range repos {
|
||||
repo, err := cloneGitlabRepo(tempDir, p)
|
||||
if err != nil {
|
||||
@@ -124,6 +122,10 @@ func createGitlabTempDir() (string, error) {
|
||||
}
|
||||
|
||||
func cloneGitlabRepo(tempDir string, p *gitlab.Project) (*RepoDescriptor, error) {
|
||||
var (
|
||||
repo *git.Repository
|
||||
err error
|
||||
)
|
||||
if opts.ExcludeForks && p.ForkedFromProject != nil {
|
||||
return nil, fmt.Errorf("skipping %s, excluding forks", p.Name)
|
||||
}
|
||||
@@ -145,9 +147,6 @@ func cloneGitlabRepo(tempDir string, p *gitlab.Project) (*RepoDescriptor, error)
|
||||
|
||||
log.Infof("cloning: %s", p.Name)
|
||||
|
||||
var repo *git.Repository
|
||||
var err error
|
||||
|
||||
if opts.Disk {
|
||||
repo, err = git.PlainClone(fmt.Sprintf("%s/%d", tempDir, p.ID), false, opt)
|
||||
} else {
|
||||
|
||||
@@ -180,6 +180,14 @@ func TestRun(t *testing.T) {
|
||||
configPath string
|
||||
commitPerPage int
|
||||
}{
|
||||
{
|
||||
testOpts: Options{
|
||||
GitLabUser: "gitleakstest",
|
||||
},
|
||||
description: "test github user",
|
||||
numLeaks: 2,
|
||||
expectedErrMsg: "",
|
||||
},
|
||||
{
|
||||
testOpts: Options{
|
||||
GithubUser: "gitleakstest",
|
||||
|
||||
Reference in new issue
Block a user