Skip to content

Commit

Permalink
The colon equal sign regex should contain both colon and equal. Neith…
Browse files Browse the repository at this point in the history
…er is optional. Specific for assignment and declaration in golang (#675)
  • Loading branch information
jpdakran authored Apr 11, 2023
1 parent 1bf8134 commit 44095a0
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/keyword.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@

FOLLOWED_BY_COLON_EQUAL_SIGNS_REGEX = re.compile(
# e.g. my_password := "bar" or my_password := bar
r'{denylist}({closing})?{whitespace}:=?{whitespace}({quote}?)({secret})(\3)'.format(
r'{denylist}({closing})?{whitespace}:={whitespace}({quote}?)({secret})(\3)'.format(
denylist=DENYLIST_REGEX,
closing=CLOSING,
quote=QUOTE,
Expand Down
2 changes: 2 additions & 0 deletions tests/plugins/keyword_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@
('password := "somefakekey"', None), # 'fake' in the secret
('some_key = "real_secret"', None), # We cannot make 'key' a Keyword, too noisy)
('private_key "hopenobodyfindsthisone\';', None), # Double-quote does not match single-quote)
('password: real_key', None),
('password: "real_key"', None),
(LONG_LINE, None), # Long line test
]

Expand Down

0 comments on commit 44095a0

Please sign in to comment.