Skip to content

Commit

Permalink
↪️ Merge pull request #168 from dgzlopes/fix-117-whitelist-additional…
Browse files Browse the repository at this point in the history
…-text-support

Add support for text after whitelist
  • Loading branch information
KevinHock committed May 10, 2019
2 parents 458d7e9 + 3117bcd commit dd4de73
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion detect_secrets/plugins/common/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
WHITELIST_REGEXES = [
re.compile(r)
for r in [
r'[ \t]+{} *pragma: ?whitelist[ -]secret{}[ \t]*$'.format(start, end)
r'[ \t]+{} *pragma: ?whitelist[ -]secret.*?{}[ \t]*$'.format(start, end)
for start, end in (
('#', ''), # e.g. python or yaml
('//', ''), # e.g. golang
Expand Down
2 changes: 2 additions & 0 deletions tests/plugins/high_entropy_strings_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,12 @@ def test_analyze_multiple_strings_same_line(self, content_to_format, expected_re
[
# Test inline annotation for whitelisting
"'{secret}' # pragma: whitelist secret",
"'{secret}' # pragma: whitelist secret more text",
"'{secret}' # pragma: whitelist secret",
"'{secret}' // pragma: whitelist secret",
"'{secret}' // pragma: whitelist secret",
"'{secret}' /* pragma: whitelist secret */",
"'{secret}' /* pragma: whitelist secret more text */",
"'{secret}' /* pragma: whitelist secret */",
"'{secret}' ' pragma: whitelist secret",
"'{secret}' ' pragma: whitelist secret",
Expand Down

0 comments on commit dd4de73

Please sign in to comment.