From fd336fd4fb54173352314c7c2b79090fde615200 Mon Sep 17 00:00:00 2001 From: Anatolii Stadnichuk <134394882+anatolii-paloaltonetworks@users.noreply.github.com> Date: Mon, 29 Apr 2024 12:05:15 +0100 Subject: [PATCH] Do not require leading quotes for high-entropy strings in ini and yaml (#213) --- detect_secrets/plugins/high_entropy_strings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/detect_secrets/plugins/high_entropy_strings.py b/detect_secrets/plugins/high_entropy_strings.py index 7d5de9efa..a5b1b0b40 100644 --- a/detect_secrets/plugins/high_entropy_strings.py +++ b/detect_secrets/plugins/high_entropy_strings.py @@ -30,7 +30,7 @@ def __init__(self, charset: str, limit: float) -> None: # 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'([\'":=])\s*([{}]+)([\'"]?)'.format(re.escape(charset))) + self.regex = re.compile(r'([\'":=])\s*([{}]+)([\'"]|$)'.format(re.escape(charset))) def analyze_string(self, string: str) -> Generator[str, None, None]: for result in self.regex.findall(string):