Compare commits

..
7 Commits
Author SHA1 Message Date
Zachary Rice e95a8a7158 Merge pull request #146 from zricethezav/fix/first-commit
Fix/first commit
2018-11-06 22:35:26 -06:00
zach rice de0a70a835 changelog 2018-11-06 22:27:52 -06:00
zach rice 9f8feca926 gotta check the root 2018-11-06 22:20:42 -06:00
Zachary Rice c50187559b Merge pull request #145 from camaya/update-report-commit-message
Remove break lines in commit messages
2018-11-06 08:31:49 -06:00
Cristhian Amaya 7d5ed837a4 Remove break lines in commit messages
Breaklines in a csv report caused issues when importing the data to an
spreadsheet application like LibreOffice Calc or Microsoft Excel.
2018-11-06 11:41:38 +01:00
Zachary Rice 60267523e9 Merge pull request #144 from zricethezav/fix/files
readding default whitelist
2018-11-05 18:18:36 -06:00
zach rice 8153da6e9c readding default whitelist 2018-11-05 18:13:50 -06:00
3 changed files with 65 additions and 12 deletions

No files matched your search

+10
View File
@@ -1,6 +1,16 @@
CHANGELOG
=========
1.19.2
----
- fixed a bug where gitleaks was skipping the initial commit
- commit cache now checks curr commit + parent commit hash
- removed newlines from commit message
1.19.1
----
- mistakenly removed default whitelist files
1.19.0
----
- removed `--all-refs`. By default gitleaks now scans all branches, remote and local.
+2 -2
View File
@@ -560,7 +560,7 @@ func TestAuditRepo(t *testing.T) {
{
repo: leaksRepo,
description: "commit depth = 1, one leak",
numLeaks: 1,
numLeaks: 2,
testOpts: Options{
Depth: 1,
},
@@ -576,7 +576,7 @@ func TestAuditRepo(t *testing.T) {
{
repo: leaksRepo,
description: "toml entropy range",
numLeaks: 284,
numLeaks: 354,
configPath: path.Join(configsDir, "entropy"),
},
{
+53 -10
View File
@@ -133,7 +133,7 @@ type entropyRange struct {
}
const defaultGithubURL = "https://api.github.com/"
const version = "1.19.0"
const version = "1.19.2"
const errExit = 2
const leakExit = 1
const defaultConfig = `
@@ -173,6 +173,9 @@ description = "Slack"
regex = '''xox[baprs]-([0-9a-zA-Z]{10,48})?'''
[whitelist]
files = [
"(.*?)(jpg|gif|doc|pdf|bin)$"
]
#commits = [
# "BADHA5H1",
# "BADHA5H2",
@@ -453,24 +456,64 @@ func auditGitReference(repo *RepoDescriptor, ref *plumbing.Reference) []Leak {
return nil
}
err = cIter.ForEach(func(c *object.Commit) error {
if commitMap[c.Hash.String()] {
return nil
}
cMutex.Lock()
commitMap[c.Hash.String()] = true
cMutex.Unlock()
if c == nil || c.Hash.String() == opts.Commit || (opts.Depth != 0 && commitCount == opts.Depth) {
cIter.Close()
return errors.New("ErrStop")
}
commitCount = commitCount + 1
totalCommits = totalCommits + 1
if whiteListCommits[c.Hash.String()] {
log.Infof("skipping commit: %s\n", c.Hash.String())
return nil
}
// commits w/o parent (root of git the git ref)
if len(c.ParentHashes) == 0 {
fIter, err := c.Files()
if err != nil {
return nil
}
err = fIter.ForEach(func(f *object.File) error {
bin, err := f.IsBinary()
if bin || err != nil {
return nil
}
for _, re := range whiteListFiles {
if re.FindString(f.Name) != "" {
return nil
}
}
content, err := f.Contents()
if err != nil {
return nil
}
diff := gitDiff{
repoName: repoName,
filePath: f.Name,
content: content,
sha: c.Hash.String(),
author: c.Author.String(),
message: strings.Replace(c.Message, "\n", " ", -1),
date: c.Author.When,
}
fileLeaks := inspect(diff)
mutex.Lock()
leaks = append(leaks, fileLeaks...)
mutex.Unlock()
return nil
})
return nil
}
err = c.Parents().ForEach(func(parent *object.Commit) error {
// check if we've seen this diff before
if commitMap[c.Hash.String()+parent.Hash.String()] {
return nil
}
cMutex.Lock()
commitMap[c.Hash.String()+parent.Hash.String()] = true
cMutex.Unlock()
commitCount = commitCount + 1
totalCommits = totalCommits + 1
commitWg.Add(1)
semaphore <- true
go func(c *object.Commit, parent *object.Commit) {
@@ -520,7 +563,7 @@ func auditGitReference(repo *RepoDescriptor, ref *plumbing.Reference) []Leak {
content: chunk.Content(),
sha: c.Hash.String(),
author: c.Author.String(),
message: c.Message,
message: strings.Replace(c.Message, "\n", " ", -1),
date: c.Author.When,
}
chunkLeaks := inspect(diff)