Skip to content

Commit d412c7d

Browse files
committed
Do not require leading quotes for high-entropy strings
1 parent 44095a0 commit d412c7d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

detect_secrets/plugins/high_entropy_strings.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ def __init__(self, charset: str, limit: float) -> None:
2626
self.charset = charset
2727
self.entropy_limit = limit
2828

29-
# We require quoted strings to reduce noise.
3029
# NOTE: We need this to be a capturing group, so back-reference can work.
31-
self.regex = re.compile(r'([\'"])([{}]+)(\1)'.format(re.escape(charset)))
30+
self.regex = re.compile(r'([\'"]?)([{}]+)(\1)'.format(re.escape(charset)))
3231

3332
def analyze_string(self, string: str) -> Generator[str, None, None]:
3433
for result in self.regex.findall(string):

0 commit comments

Comments
 (0)