mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 04:34:46 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8eb28cbb4c | ||
|
|
9dc9a8e62a | ||
|
|
e6caef0d94 | ||
|
|
5e289ed0cc | ||
|
|
d99588fe19 | ||
|
|
a7ccb7a9d1 | ||
|
|
f32abb921d | ||
|
|
e8851c1f99 |
No files matched your search
@@ -1,6 +1,10 @@
|
|||||||
CHANGELOG
|
CHANGELOG
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
1.3.0
|
||||||
|
-----
|
||||||
|
- Target specific branch
|
||||||
|
|
||||||
1.2.1
|
1.2.1
|
||||||
-----
|
-----
|
||||||
- Check errors when generating commit patch
|
- Check errors when generating commit patch
|
||||||
|
|||||||
+2
-2
@@ -18,7 +18,7 @@ regex = '''-----BEGIN OPENSSH PRIVATE KEY-----'''
|
|||||||
description = "Facebook"
|
description = "Facebook"
|
||||||
regex = '''(?i)facebook.*['\"][0-9a-f]{32}['\"]'''
|
regex = '''(?i)facebook.*['\"][0-9a-f]{32}['\"]'''
|
||||||
[[regexes]]
|
[[regexes]]
|
||||||
description = "Facebook"
|
description = "Twitter"
|
||||||
regex = '''(?i)twitter.*['\"][0-9a-zA-Z]{35,44}['\"]'''
|
regex = '''(?i)twitter.*['\"][0-9a-zA-Z]{35,44}['\"]'''
|
||||||
|
|
||||||
[whitelist]
|
[whitelist]
|
||||||
@@ -27,4 +27,4 @@ regexes = [
|
|||||||
]
|
]
|
||||||
files = [
|
files = [
|
||||||
"(.*?)(jpg|gif|doc|pdf|bin|go)$"
|
"(.*?)(jpg|gif|doc|pdf|bin|go)$"
|
||||||
]
|
]
|
||||||
@@ -339,6 +339,22 @@ func TestAuditRepo(t *testing.T) {
|
|||||||
MaxGoRoutines: 2,
|
MaxGoRoutines: 2,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
repo: leaksRepo,
|
||||||
|
description: "audit specific bad branch",
|
||||||
|
numLeaks: 2,
|
||||||
|
testOpts: Options{
|
||||||
|
Branch: "master",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
repo: leaksRepo,
|
||||||
|
description: "audit specific good branch",
|
||||||
|
numLeaks: 0,
|
||||||
|
testOpts: Options{
|
||||||
|
Branch: "dev",
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
repo: leaksRepo,
|
repo: leaksRepo,
|
||||||
description: "audit all branch",
|
description: "audit all branch",
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ type Config struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const defaultGithubURL = "https://api.github.com/"
|
const defaultGithubURL = "https://api.github.com/"
|
||||||
const version = "1.1.2"
|
const version = "1.3.0"
|
||||||
const defaultConfig = `
|
const defaultConfig = `
|
||||||
title = "gitleaks config"
|
title = "gitleaks config"
|
||||||
# add regexes to the regex table
|
# add regexes to the regex table
|
||||||
@@ -445,6 +445,22 @@ func auditRepo(r *git.Repository) ([]Leak, error) {
|
|||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
if opts.Branch != "" {
|
||||||
|
foundBranch := false
|
||||||
|
refs, _ := r.Storer.IterReferences()
|
||||||
|
branch := strings.Split(opts.Branch, "/")[len(strings.Split(opts.Branch, "/"))-1]
|
||||||
|
err = refs.ForEach(func(refBranch *plumbing.Reference) error {
|
||||||
|
if strings.Split(refBranch.Name().String(), "/")[len(strings.Split(refBranch.Name().String(), "/"))-1] == branch {
|
||||||
|
foundBranch = true
|
||||||
|
ref = refBranch
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
if foundBranch == false {
|
||||||
|
log.Fatalf("No branch with name", opts.Branch)
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
auditRef(r, ref, &commitWg, commitChan)
|
auditRef(r, ref, &commitWg, commitChan)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user