mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 04:34:46 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cc6d698e63 | ||
|
|
2ba97d0fa3 | ||
|
|
d299b5aa7f | ||
|
|
0a209b60a5 | ||
|
|
fe8c6271f2 | ||
|
|
42fb085684 |
No files matched your search
@@ -1,6 +1,24 @@
|
|||||||
CHANGELOG
|
CHANGELOG
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
1.7.2
|
||||||
|
-----
|
||||||
|
- Fixing dangling goroutines, removing channel messaging
|
||||||
|
|
||||||
|
1.7.1
|
||||||
|
-----
|
||||||
|
- Fixing bug where single repos were not being audited
|
||||||
|
|
||||||
|
1.7.0
|
||||||
|
-----
|
||||||
|
- Exit code == 2 on error
|
||||||
|
- Cleaning up some logs
|
||||||
|
- Removing some unreachable code
|
||||||
|
|
||||||
|
1.6.1
|
||||||
|
-----
|
||||||
|
- Recover from panic when diffing
|
||||||
|
|
||||||
1.6.0
|
1.6.0
|
||||||
-----
|
-----
|
||||||
- Default maximum goroutines spawned is number of cores your cpu run with. See benchmarks in wiki.
|
- Default maximum goroutines spawned is number of cores your cpu run with. See benchmarks in wiki.
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# Contributing Guidelines
|
||||||
|
|
||||||
|
The gitleaks project is under [GNU General Public License v3.0](LICENSE.md) and accepts
|
||||||
|
contributions via GitHub pull requests.
|
||||||
|
|
||||||
|
## How to Contribute
|
||||||
|
|
||||||
|
Open a PR. Give the PR a descriptive title. Add some comments describing whats the purpose of the PR.
|
||||||
|
|
||||||
|
__BUT before you do that!__
|
||||||
|
|
||||||
|
Make sure you pass this list of requirements.
|
||||||
|
|
||||||
|
- You've ran `go fmt`.
|
||||||
|
- You've ran `golint`.
|
||||||
|
- Your Go changes are confined to `gitleaks_test.go` and `main.go`. This is subject to change as the project evolves. Stylistically, I like having a single go file considering the size of this project (its tiny).
|
||||||
|
- You've added test cases for your changes.
|
||||||
|
- You've updated [the changelog](CHANGELOG.md).
|
||||||
|
- Your tests pass.
|
||||||
|
|
||||||
@@ -52,8 +52,9 @@ Help Options:
|
|||||||
```
|
```
|
||||||
#### Exit Codes
|
#### Exit Codes
|
||||||
```
|
```
|
||||||
1: leaks present
|
|
||||||
0: no leaks
|
0: no leaks
|
||||||
|
1: leaks present
|
||||||
|
2: error encountered
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Additional Examples and Explanations
|
#### Additional Examples and Explanations
|
||||||
|
|||||||
+114
-1
@@ -165,6 +165,119 @@ func TestGetRepo(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
func TestRunAudit(t *testing.T) {
|
||||||
|
err := loadToml()
|
||||||
|
configsDir := testTomlLoader()
|
||||||
|
defer os.RemoveAll(configsDir)
|
||||||
|
|
||||||
|
dir, err = ioutil.TempDir("", "gitleaksTestOwner")
|
||||||
|
defer os.RemoveAll(dir)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
git.PlainClone(dir+"/gronit", false, &git.CloneOptions{
|
||||||
|
URL: "https://github.com/gitleakstest/gronit",
|
||||||
|
})
|
||||||
|
git.PlainClone(dir+"/h1domains", false, &git.CloneOptions{
|
||||||
|
URL: "https://github.com/gitleakstest/h1domains",
|
||||||
|
})
|
||||||
|
var tests = []struct {
|
||||||
|
testOpts Options
|
||||||
|
description string
|
||||||
|
expectedErrMsg string
|
||||||
|
numLeaks int
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
testOpts: Options{
|
||||||
|
GithubUser: "gitleakstest",
|
||||||
|
},
|
||||||
|
description: "test github user",
|
||||||
|
numLeaks: 2,
|
||||||
|
expectedErrMsg: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testOpts: Options{
|
||||||
|
GithubUser: "gitleakstest",
|
||||||
|
Disk: true,
|
||||||
|
},
|
||||||
|
description: "test github user on disk ",
|
||||||
|
numLeaks: 2,
|
||||||
|
expectedErrMsg: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testOpts: Options{
|
||||||
|
GithubOrg: "gitleakstestorg",
|
||||||
|
},
|
||||||
|
description: "test github org",
|
||||||
|
numLeaks: 2,
|
||||||
|
expectedErrMsg: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testOpts: Options{
|
||||||
|
GithubOrg: "gitleakstestorg",
|
||||||
|
Disk: true,
|
||||||
|
},
|
||||||
|
description: "test org on disk",
|
||||||
|
numLeaks: 2,
|
||||||
|
expectedErrMsg: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testOpts: Options{
|
||||||
|
OwnerPath: dir,
|
||||||
|
},
|
||||||
|
description: "test owner path",
|
||||||
|
numLeaks: 2,
|
||||||
|
expectedErrMsg: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testOpts: Options{
|
||||||
|
GithubOrg: "gitleakstestorg",
|
||||||
|
IncludePrivate: true,
|
||||||
|
SSHKey: "reallyreallyreallyreallywrongpath",
|
||||||
|
},
|
||||||
|
description: "test private org no ssh",
|
||||||
|
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 {
|
||||||
|
g.Describe("TestRunAudit", func() {
|
||||||
|
g.It(test.description, func() {
|
||||||
|
opts = test.testOpts
|
||||||
|
leaks, err := run()
|
||||||
|
if err != nil {
|
||||||
|
g.Assert(err.Error()).Equal(test.expectedErrMsg)
|
||||||
|
}
|
||||||
|
g.Assert(len(leaks)).Equal(test.numLeaks)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestStartAudit(t *testing.T) {
|
func TestStartAudit(t *testing.T) {
|
||||||
err := loadToml()
|
err := loadToml()
|
||||||
@@ -386,7 +499,7 @@ func TestAuditRepo(t *testing.T) {
|
|||||||
description: "two leaks present limit goroutines",
|
description: "two leaks present limit goroutines",
|
||||||
numLeaks: 2,
|
numLeaks: 2,
|
||||||
testOpts: Options{
|
testOpts: Options{
|
||||||
MaxGoRoutines: 2,
|
MaxGoRoutines: 4,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -119,7 +119,9 @@ type Config struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const defaultGithubURL = "https://api.github.com/"
|
const defaultGithubURL = "https://api.github.com/"
|
||||||
const version = "1.6.0"
|
const version = "1.7.1"
|
||||||
|
const errExit = 2
|
||||||
|
const leakExit = 1
|
||||||
const defaultConfig = `
|
const defaultConfig = `
|
||||||
title = "gitleaks config"
|
title = "gitleaks config"
|
||||||
# add regexes to the regex table
|
# add regexes to the regex table
|
||||||
@@ -187,60 +189,55 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var (
|
|
||||||
leaks []Leak
|
|
||||||
)
|
|
||||||
_, err := flags.Parse(&opts)
|
_, err := flags.Parse(&opts)
|
||||||
if opts.Version {
|
if opts.Version {
|
||||||
fmt.Println(version)
|
fmt.Println(version)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
leaks, err := run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
os.Exit(1)
|
log.Error(err)
|
||||||
|
os.Exit(errExit)
|
||||||
}
|
}
|
||||||
setLogs()
|
|
||||||
|
|
||||||
err = optsGuard()
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
err = loadToml()
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if opts.IncludePrivate {
|
|
||||||
// if including private repos use ssh as authentication
|
|
||||||
sshAuth, err = getSSHAuth()
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if opts.Disk {
|
|
||||||
// temporary directory where all the gitleaks plain clones will reside
|
|
||||||
dir, err = ioutil.TempDir("", "gitleaks")
|
|
||||||
defer os.RemoveAll(dir)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
leaks, err = startAudits()
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if opts.Report != "" {
|
if opts.Report != "" {
|
||||||
writeReport(leaks)
|
writeReport(leaks)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(leaks) != 0 {
|
if len(leaks) != 0 {
|
||||||
log.Errorf("leaks detected")
|
log.Warnf("leaks detected")
|
||||||
os.Exit(1)
|
os.Exit(leakExit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// run parses options and kicks off the audit
|
||||||
|
func run() ([]Leak, error) {
|
||||||
|
setLogs()
|
||||||
|
err := optsGuard()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
err = loadToml()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if opts.IncludePrivate {
|
||||||
|
// if including private repos use ssh as authentication
|
||||||
|
sshAuth, err = getSSHAuth()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if opts.Disk {
|
||||||
|
// temporary directory where all the gitleaks plain clones will reside
|
||||||
|
dir, err = ioutil.TempDir("", "gitleaks")
|
||||||
|
defer os.RemoveAll(dir)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return startAudits()
|
||||||
|
}
|
||||||
|
|
||||||
func startAudits() ([]Leak, error) {
|
func startAudits() ([]Leak, error) {
|
||||||
var leaks []Leak
|
var leaks []Leak
|
||||||
// start audits
|
// start audits
|
||||||
@@ -275,7 +272,7 @@ func startAudits() ([]Leak, error) {
|
|||||||
log.Warnf("leaks found for repo %s", *githubRepo.Name)
|
log.Warnf("leaks found for repo %s", *githubRepo.Name)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return leaks, err
|
log.Warn(err)
|
||||||
}
|
}
|
||||||
leaks = append(leaks, leaksFromRepo...)
|
leaks = append(leaks, leaksFromRepo...)
|
||||||
}
|
}
|
||||||
@@ -313,7 +310,6 @@ func getRepo() (Repo, error) {
|
|||||||
err error
|
err error
|
||||||
repo *git.Repository
|
repo *git.Repository
|
||||||
)
|
)
|
||||||
|
|
||||||
if opts.Disk {
|
if opts.Disk {
|
||||||
log.Infof("cloning %s", opts.Repo)
|
log.Infof("cloning %s", opts.Repo)
|
||||||
cloneTarget := fmt.Sprintf("%s/%x", dir, md5.Sum([]byte(fmt.Sprintf("%s%s", opts.GithubUser, opts.Repo))))
|
cloneTarget := fmt.Sprintf("%s/%x", dir, md5.Sum([]byte(fmt.Sprintf("%s%s", opts.GithubUser, opts.Repo))))
|
||||||
@@ -360,21 +356,25 @@ func getRepo() (Repo, error) {
|
|||||||
// auditRef audits a git reference
|
// auditRef audits a git reference
|
||||||
// TODO: need to add a layer of parallelism here and a cache for parent+child commits so we don't
|
// TODO: need to add a layer of parallelism here and a cache for parent+child commits so we don't
|
||||||
// double dip
|
// double dip
|
||||||
func auditRef(repo Repo, ref *plumbing.Reference, commitWg *sync.WaitGroup, commitChan chan []Leak) error {
|
func auditRef(repo Repo, ref *plumbing.Reference) []Leak {
|
||||||
var (
|
var (
|
||||||
err error
|
err error
|
||||||
prevCommit *object.Commit
|
prevCommit *object.Commit
|
||||||
semaphore chan bool
|
semaphore chan bool
|
||||||
repoName string
|
repoName string
|
||||||
|
leaks []Leak
|
||||||
|
commitWg sync.WaitGroup
|
||||||
|
mutex = &sync.Mutex{}
|
||||||
)
|
)
|
||||||
repoName = repo.name
|
repoName = repo.name
|
||||||
if opts.MaxGoRoutines != 0 {
|
if opts.MaxGoRoutines != 0 {
|
||||||
maxGo = opts.MaxGoRoutines
|
maxGo = opts.MaxGoRoutines
|
||||||
}
|
}
|
||||||
|
|
||||||
semaphore = make(chan bool, maxGo)
|
semaphore = make(chan bool, maxGo)
|
||||||
cIter, err := repo.repository.Log(&git.LogOptions{From: ref.Hash()})
|
cIter, err := repo.repository.Log(&git.LogOptions{From: ref.Hash()})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return nil
|
||||||
}
|
}
|
||||||
err = cIter.ForEach(func(c *object.Commit) error {
|
err = cIter.ForEach(func(c *object.Commit) error {
|
||||||
if c.Hash.String() == opts.Commit {
|
if c.Hash.String() == opts.Commit {
|
||||||
@@ -384,15 +384,21 @@ func auditRef(repo Repo, ref *plumbing.Reference, commitWg *sync.WaitGroup, comm
|
|||||||
log.Infof("skipping commit: %s\n", c.Hash.String())
|
log.Infof("skipping commit: %s\n", c.Hash.String())
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
semaphore <- true
|
|
||||||
commitWg.Add(1)
|
commitWg.Add(1)
|
||||||
|
semaphore <- true
|
||||||
go func(c *object.Commit, prevCommit *object.Commit) {
|
go func(c *object.Commit, prevCommit *object.Commit) {
|
||||||
var (
|
var (
|
||||||
leaks []Leak
|
|
||||||
filePath string
|
filePath string
|
||||||
skipFile bool
|
skipFile bool
|
||||||
)
|
)
|
||||||
|
defer func() {
|
||||||
|
commitWg.Done()
|
||||||
|
<-semaphore
|
||||||
|
if r := recover(); r != nil {
|
||||||
|
log.Warnf("recoverying from panic on commit %s, likely large diff causing panic", c.Hash.String())
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
if prevCommit == nil {
|
if prevCommit == nil {
|
||||||
t, _ := c.Tree()
|
t, _ := c.Tree()
|
||||||
files := t.Files()
|
files := t.Files()
|
||||||
@@ -401,21 +407,22 @@ func auditRef(repo Repo, ref *plumbing.Reference, commitWg *sync.WaitGroup, comm
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
leaks = append(leaks, checkDiff(content, c, file.Name, string(ref.Name()), repoName)...)
|
chunkLeaks := checkDiff(content, c, file.Name, string(ref.Name()), repoName)
|
||||||
|
for _, leak := range chunkLeaks {
|
||||||
|
mutex.Lock()
|
||||||
|
leaks = append(leaks, leak)
|
||||||
|
mutex.Unlock()
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warnf("problem generating diff for commit: %s\n", c.Hash.String())
|
log.Warnf("problem generating diff for commit: %s\n", c.Hash.String())
|
||||||
<-semaphore
|
|
||||||
commitChan <- leaks
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
patch, err := c.Patch(prevCommit)
|
patch, err := c.Patch(prevCommit)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warnf("problem generating patch for commit: %s\n", c.Hash.String())
|
log.Warnf("problem generating patch for commit: %s\n", c.Hash.String())
|
||||||
<-semaphore
|
|
||||||
commitChan <- leaks
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for _, f := range patch.FilePatches() {
|
for _, f := range patch.FilePatches() {
|
||||||
@@ -440,27 +447,30 @@ func auditRef(repo Repo, ref *plumbing.Reference, commitWg *sync.WaitGroup, comm
|
|||||||
for _, chunk := range chunks {
|
for _, chunk := range chunks {
|
||||||
if chunk.Type() == 1 || chunk.Type() == 2 {
|
if chunk.Type() == 1 || chunk.Type() == 2 {
|
||||||
// only check if adding or removing
|
// only check if adding or removing
|
||||||
leaks = append(leaks, checkDiff(chunk.Content(), prevCommit, filePath, string(ref.Name()), repoName)...)
|
chunkLeaks := checkDiff(chunk.Content(), prevCommit, filePath, string(ref.Name()), repoName)
|
||||||
|
for _, leak := range chunkLeaks {
|
||||||
|
mutex.Lock()
|
||||||
|
leaks = append(leaks, leak)
|
||||||
|
mutex.Unlock()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<-semaphore
|
|
||||||
commitChan <- leaks
|
|
||||||
}(c, prevCommit)
|
}(c, prevCommit)
|
||||||
prevCommit = c
|
prevCommit = c
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
return nil
|
commitWg.Wait()
|
||||||
|
return leaks
|
||||||
}
|
}
|
||||||
|
|
||||||
// auditRepo performs an audit on a repository checking for regex matching and ignoring
|
// auditRepo performs an audit on a repository checking for regex matching and ignoring
|
||||||
// files and regexes that are whitelisted
|
// files and regexes that are whitelisted
|
||||||
func auditRepo(repo Repo) ([]Leak, error) {
|
func auditRepo(repo Repo) ([]Leak, error) {
|
||||||
var (
|
var (
|
||||||
err error
|
err error
|
||||||
leaks []Leak
|
leaks []Leak
|
||||||
commitWg sync.WaitGroup
|
|
||||||
)
|
)
|
||||||
|
|
||||||
ref, err := repo.repository.Head()
|
ref, err := repo.repository.Head()
|
||||||
@@ -468,9 +478,6 @@ func auditRepo(repo Repo) ([]Leak, error) {
|
|||||||
return leaks, err
|
return leaks, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// leak messaging
|
|
||||||
commitChan := make(chan []Leak, 1)
|
|
||||||
|
|
||||||
if opts.AuditAllRefs {
|
if opts.AuditAllRefs {
|
||||||
skipBranch := false
|
skipBranch := false
|
||||||
refs, err := repo.repository.Storer.IterReferences()
|
refs, err := repo.repository.Storer.IterReferences()
|
||||||
@@ -487,7 +494,10 @@ func auditRepo(repo Repo) ([]Leak, error) {
|
|||||||
skipBranch = false
|
skipBranch = false
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
auditRef(repo, ref, &commitWg, commitChan)
|
branchLeaks := auditRef(repo, ref)
|
||||||
|
for _, leak := range branchLeaks {
|
||||||
|
leaks = append(leaks, leak)
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@@ -503,26 +513,11 @@ func auditRepo(repo Repo) ([]Leak, error) {
|
|||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if foundBranch == false {
|
if foundBranch == false {
|
||||||
log.Fatalf("No branch with name", opts.Branch)
|
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auditRef(repo, ref, &commitWg, commitChan)
|
leaks = auditRef(repo, ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
|
||||||
for commitLeaks := range commitChan {
|
|
||||||
if commitLeaks != nil {
|
|
||||||
for _, leak := range commitLeaks {
|
|
||||||
leaks = append(leaks, leak)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
commitWg.Done()
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
commitWg.Wait()
|
|
||||||
return leaks, err
|
return leaks, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -599,7 +594,7 @@ func getGithubRepos() ([]*github.Repository, error) {
|
|||||||
githubClient.BaseURL = ghURL
|
githubClient.BaseURL = ghURL
|
||||||
}
|
}
|
||||||
githubOrgOptions = &github.RepositoryListByOrgOptions{
|
githubOrgOptions = &github.RepositoryListByOrgOptions{
|
||||||
ListOptions: github.ListOptions{PerPage: 10},
|
ListOptions: github.ListOptions{PerPage: 100},
|
||||||
}
|
}
|
||||||
} else if opts.GithubUser != "" {
|
} else if opts.GithubUser != "" {
|
||||||
githubClient = github.NewClient(githubToken())
|
githubClient = github.NewClient(githubToken())
|
||||||
@@ -611,7 +606,7 @@ func getGithubRepos() ([]*github.Repository, error) {
|
|||||||
githubOptions = &github.RepositoryListOptions{
|
githubOptions = &github.RepositoryListOptions{
|
||||||
Affiliation: "owner",
|
Affiliation: "owner",
|
||||||
ListOptions: github.ListOptions{
|
ListOptions: github.ListOptions{
|
||||||
PerPage: 10,
|
PerPage: 100,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -632,7 +627,7 @@ func getGithubRepos() ([]*github.Repository, error) {
|
|||||||
return githubRepos, err
|
return githubRepos, err
|
||||||
}
|
}
|
||||||
} else if opts.GithubOrg != "" {
|
} else if opts.GithubOrg != "" {
|
||||||
rs, resp, err := githubClient.Repositories.ListByOrg(ctx, opts.GithubOrg, githubOrgOptions)
|
rs, resp, err = githubClient.Repositories.ListByOrg(ctx, opts.GithubOrg, githubOrgOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -642,8 +637,10 @@ func getGithubRepos() ([]*github.Repository, error) {
|
|||||||
return githubRepos, err
|
return githubRepos, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, githubRepo := range githubRepos {
|
if opts.Log == "Debug" || opts.Log == "debug" {
|
||||||
log.Infof("staging repo %s", *githubRepo.Name)
|
for _, githubRepo := range rs {
|
||||||
|
log.Debugf("staging repos %s", *githubRepo.Name)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -871,7 +868,7 @@ func getSSHAuth() (*ssh.PublicKeys, error) {
|
|||||||
return sshAuth, err
|
return sshAuth, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (leak *Leak) log() {
|
func (leak Leak) log() {
|
||||||
b, _ := json.MarshalIndent(leak, "", " ")
|
b, _ := json.MarshalIndent(leak, "", " ")
|
||||||
fmt.Println(string(b))
|
fmt.Println(string(b))
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user