Skip to content

Commit 44095a0

Browse files
authored
The colon equal sign regex should contain both colon and equal. Neither is optional. Specific for assignment and declaration in golang (#675)
1 parent 1bf8134 commit 44095a0

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

detect_secrets/plugins/keyword.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898

9999
FOLLOWED_BY_COLON_EQUAL_SIGNS_REGEX = re.compile(
100100
# e.g. my_password := "bar" or my_password := bar
101-
r'{denylist}({closing})?{whitespace}:=?{whitespace}({quote}?)({secret})(\3)'.format(
101+
r'{denylist}({closing})?{whitespace}:={whitespace}({quote}?)({secret})(\3)'.format(
102102
denylist=DENYLIST_REGEX,
103103
closing=CLOSING,
104104
quote=QUOTE,

tests/plugins/keyword_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@
8383
('password := "somefakekey"', None), # 'fake' in the secret
8484
('some_key = "real_secret"', None), # We cannot make 'key' a Keyword, too noisy)
8585
('private_key "hopenobodyfindsthisone\';', None), # Double-quote does not match single-quote)
86+
('password: real_key', None),
87+
('password: "real_key"', None),
8688
(LONG_LINE, None), # Long line test
8789
]
8890

0 commit comments

Comments
 (0)