Skip to content

Commit

Permalink
check the whitelist regex in the base plugin class
Browse files Browse the repository at this point in the history
  • Loading branch information
calvinli committed Dec 6, 2018
1 parent 138816f commit 15701df
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions detect_secrets/plugins/base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from abc import ABCMeta
from abc import abstractmethod

from detect_secrets.plugins.core.constants import WHITELIST_REGEX


class BasePlugin(object):
"""This is an abstract class to define Plugins API"""
Expand All @@ -23,6 +25,8 @@ def analyze(self, file, filename):
"""
potential_secrets = {}
for line_num, line in enumerate(file.readlines(), start=1):
if WHITELIST_REGEX.search(line):
continue
secrets = self.analyze_string(line, line_num, filename)
potential_secrets.update(secrets)

Expand Down
2 changes: 2 additions & 0 deletions test_data/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ keyB = 456789123
567891234

keyC =

password = 12345678901234 # pragma: whitelist secret

0 comments on commit 15701df

Please sign in to comment.