From b824dd9dc4abf2de707cd5353fc30ebf2499b7b5 Mon Sep 17 00:00:00 2001 From: arielkru <63583491+arielkru@users.noreply.github.com> Date: Mon, 1 Jul 2024 11:24:45 +0300 Subject: [PATCH] Improve performance of azure storage key regex (#218) --- detect_secrets/plugins/azure_storage_key.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/detect_secrets/plugins/azure_storage_key.py b/detect_secrets/plugins/azure_storage_key.py index 32644f1c8..a3f4eb12a 100644 --- a/detect_secrets/plugins/azure_storage_key.py +++ b/detect_secrets/plugins/azure_storage_key.py @@ -32,10 +32,10 @@ class AzureStorageKeyDetector(RegexBasedDetector): r'{account_key}=\s*{secret}', # maximum 2 lines secret distance under azure mention (case-insensitive) - r'(?i){azure}.*\n?.*\n?.*{secret}', + r'(?i)\b{azure}(.*\n){{0,2}}.*{secret}', # maximum 2 lines secret distance above azure mention (case-insensitive) - r'(?i){secret}.*\n?.*\n?.*{azure}', + r'(?i)\b{secret}(.*\n){{0,2}}.*{azure}', ] def analyze_line(