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:
Zachary Rice authored and GitHub committed 2020-12-09 15:55:01 -05:00
1 parent 86cfe0848b
commit 2d58f1f94e
4 files changed
+48

No files matched your search

+10
View File
@@ -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