Skip to content

Commit 818d246

Browse files
XIANJUN ZHUjustineyster
XIANJUN ZHU
authored andcommitted
Avoid matching CR (Yelp#271)
1 parent 8fb4719 commit 818d246

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

detect_secrets/plugins/db2.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class Db2Detector(RegexBasedDetector):
6161
# catch any character except newline and quotations, we exclude these
6262
# because the regex will erronously match them when present at the end of the password
6363
# db2 password requirements vary by version so we cast a broad net
64-
password = r'([^\n"\']+)'
64+
password = r'([^\r\n"\']+)'
6565
denylist = (
6666
re.compile(
6767
r'{begin}{opt_quote}{opt_db}{opt_dash_undrscr}{password_keyword}{opt_quote}{opt_space}'

tests/plugins/db2_test.py

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class TestGheDetector(object):
4646
(':anothersyntax!', 'pwd::anothersyntax!', True),
4747
('@#!%#', 'DB2_PASSWORD = "@#!%#"', True),
4848
('pass', 'dashdb-password = "pass"', True),
49+
('pass', 'dashdb-password = pass\r', True),
4950
('', 'dashdb_host = notapassword', False),
5051
('', 'someotherpassword = "doesnt start right"', False),
5152
],

0 commit comments

Comments
 (0)