diff --git a/detect_secrets/plugins/high_entropy_strings.py b/detect_secrets/plugins/high_entropy_strings.py index 5a352cb1..a2ca65de 100644 --- a/detect_secrets/plugins/high_entropy_strings.py +++ b/detect_secrets/plugins/high_entropy_strings.py @@ -26,9 +26,8 @@ def __init__(self, charset: str, limit: float) -> None: self.charset = charset self.entropy_limit = limit - # We require quoted strings to reduce noise. # NOTE: We need this to be a capturing group, so back-reference can work. - self.regex = re.compile(r'([\'"])([{}]+)(\1)'.format(re.escape(charset))) + self.regex = re.compile(r'([\'"]?)([{}]+)(\1)'.format(re.escape(charset))) def analyze_string(self, string: str) -> Generator[str, None, None]: for result in self.regex.findall(string):