From f899e405e9a8e43ab2d36a857634b956aa3dc8aa Mon Sep 17 00:00:00 2001 From: arielk Date: Mon, 1 Jul 2024 10:40:50 +0300 Subject: [PATCH] improve performance of regex --- 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(