Allow list bugs (#484)

* fix allowlist bug
This commit is contained in:
Zachary Rice authored and GitHub committed 2020-12-09 13:21:15 -05:00
1 parent 973d74e592
commit 86cfe0848b
34 files changed
+232 -36

No files matched your search

+7 -4
View File
@@ -103,14 +103,17 @@ func (cs *CommitScanner) Scan() (Report, error) {
// Check the actual content
for _, line := range strings.Split(chunk.Content(), "\n") {
for _, rule := range cs.cfg.Rules {
if rule.AllowList.FileAllowed(filepath.Base(to.Path())) ||
rule.AllowList.PathAllowed(to.Path()) ||
rule.AllowList.CommitAllowed(cs.commit.Hash.String()) {
continue
}
offender := rule.Inspect(line)
if offender == "" {
continue
}
if cs.cfg.Allowlist.RegexAllowed(line) ||
rule.AllowList.FileAllowed(filepath.Base(to.Path())) ||
rule.AllowList.PathAllowed(to.Path()) ||
rule.AllowList.CommitAllowed(cs.commit.Hash.String()) {
if cs.cfg.Allowlist.RegexAllowed(line) {
continue
}