mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-28 12:14:22 +01:00
Files at commit allow list bug (#485)
* fix allowlist bug * Adding new repo for testing allowlisting * Adding missing allowlist checks for commits and files/paths
This commit is contained in:
1 parent
86cfe0848b
commit
2d58f1f94e
4 files changed
+48
No files matched your search
@@ -38,6 +38,11 @@ func NewFilesAtCommitScanner(opts options.Options, cfg config.Config, repo *git.
|
||||
// Scan kicks off a FilesAtCommitScanner Scan
|
||||
func (fs *FilesAtCommitScanner) Scan() (Report, error) {
|
||||
var scannerReport Report
|
||||
|
||||
if fs.cfg.Allowlist.CommitAllowed(fs.commit.Hash.String()) {
|
||||
return scannerReport, nil
|
||||
}
|
||||
|
||||
fIter, err := fs.commit.Files()
|
||||
if err != nil {
|
||||
return scannerReport, err
|
||||
@@ -51,6 +56,11 @@ func (fs *FilesAtCommitScanner) Scan() (Report, error) {
|
||||
return err
|
||||
}
|
||||
|
||||
if fs.cfg.Allowlist.FileAllowed(filepath.Base(f.Name)) ||
|
||||
fs.cfg.Allowlist.PathAllowed(f.Name) {
|
||||
return nil
|
||||
}
|
||||
|
||||
content, err := f.Contents()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in new issue
Block a user