mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 13: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
|
CHANGELOG
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
1.20.0
|
||||||
|
----
|
||||||
|
- adding gitlab user and group support
|
||||||
|
|
||||||
1.19.3
|
1.19.3
|
||||||
----
|
----
|
||||||
- memoizing root commit
|
- memoizing root commit
|
||||||
|
|||||||
@@ -19,12 +19,13 @@ const gitlabPages = 100
|
|||||||
// that error is logged.
|
// that error is logged.
|
||||||
func auditGitlabRepos() ([]Leak, error) {
|
func auditGitlabRepos() ([]Leak, error) {
|
||||||
var (
|
var (
|
||||||
ps []*gitlab.Project
|
ps []*gitlab.Project
|
||||||
resp *gitlab.Response
|
resp *gitlab.Response
|
||||||
err error
|
leaks []Leak
|
||||||
|
tempDir string
|
||||||
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
leaks := make([]Leak, 0)
|
|
||||||
repos := make([]*gitlab.Project, 0, gitlabPages)
|
repos := make([]*gitlab.Project, 0, gitlabPages)
|
||||||
page := 1
|
page := 1
|
||||||
cl := gitlab.NewClient(nil, os.Getenv("GITLAB_TOKEN"))
|
cl := gitlab.NewClient(nil, os.Getenv("GITLAB_TOKEN"))
|
||||||
@@ -70,15 +71,12 @@ func auditGitlabRepos() ([]Leak, error) {
|
|||||||
|
|
||||||
log.Debugf("found projects: %d", len(repos))
|
log.Debugf("found projects: %d", len(repos))
|
||||||
|
|
||||||
var tempDir string
|
|
||||||
|
|
||||||
if opts.Disk {
|
if opts.Disk {
|
||||||
if tempDir, err = createGitlabTempDir(); err != nil {
|
if tempDir, err = createGitlabTempDir(); err != nil {
|
||||||
log.Fatal("error creating temp directory: ", err)
|
log.Fatal("error creating temp directory: ", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: use goroutines?
|
|
||||||
for _, p := range repos {
|
for _, p := range repos {
|
||||||
repo, err := cloneGitlabRepo(tempDir, p)
|
repo, err := cloneGitlabRepo(tempDir, p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -124,6 +122,10 @@ func createGitlabTempDir() (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func cloneGitlabRepo(tempDir string, p *gitlab.Project) (*RepoDescriptor, error) {
|
func cloneGitlabRepo(tempDir string, p *gitlab.Project) (*RepoDescriptor, error) {
|
||||||
|
var (
|
||||||
|
repo *git.Repository
|
||||||
|
err error
|
||||||
|
)
|
||||||
if opts.ExcludeForks && p.ForkedFromProject != nil {
|
if opts.ExcludeForks && p.ForkedFromProject != nil {
|
||||||
return nil, fmt.Errorf("skipping %s, excluding forks", p.Name)
|
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)
|
log.Infof("cloning: %s", p.Name)
|
||||||
|
|
||||||
var repo *git.Repository
|
|
||||||
var err error
|
|
||||||
|
|
||||||
if opts.Disk {
|
if opts.Disk {
|
||||||
repo, err = git.PlainClone(fmt.Sprintf("%s/%d", tempDir, p.ID), false, opt)
|
repo, err = git.PlainClone(fmt.Sprintf("%s/%d", tempDir, p.ID), false, opt)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -180,6 +180,14 @@ func TestRun(t *testing.T) {
|
|||||||
configPath string
|
configPath string
|
||||||
commitPerPage int
|
commitPerPage int
|
||||||
}{
|
}{
|
||||||
|
{
|
||||||
|
testOpts: Options{
|
||||||
|
GitLabUser: "gitleakstest",
|
||||||
|
},
|
||||||
|
description: "test github user",
|
||||||
|
numLeaks: 2,
|
||||||
|
expectedErrMsg: "",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
testOpts: Options{
|
testOpts: Options{
|
||||||
GithubUser: "gitleakstest",
|
GithubUser: "gitleakstest",
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ type entropyRange struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const defaultGithubURL = "https://api.github.com/"
|
const defaultGithubURL = "https://api.github.com/"
|
||||||
const version = "1.19.3"
|
const version = "1.20.0"
|
||||||
const errExit = 2
|
const errExit = 2
|
||||||
const leakExit = 1
|
const leakExit = 1
|
||||||
const defaultConfig = `
|
const defaultConfig = `
|
||||||
|
|||||||
Reference in new issue
Block a user