@@ -18,7 +18,8 @@ class AzureStorageKeyDetector(RegexBasedDetector):
1818 """Scans for Azure Storage Account access keys."""
1919 secret_type = 'Azure Storage Account access key'
2020
21- account_key = 'AccountKey'
21+ account_key = r'account[_]?k(?:ey)?\b'
22+ account_key_check = re .compile (r'account[_]?k(?:ey)?\b' , re .IGNORECASE )
2223 azure = 'azure'
2324
2425 max_line_length = 4000
@@ -28,12 +29,12 @@ class AzureStorageKeyDetector(RegexBasedDetector):
2829 denylist = [
2930 # Account Key (AccountKey=xxxxxxxxx)
3031 re .compile (
31- r'(?:["\']?[A-Za-z0-9+\/]{86,1000 }==["\']?)' ,
32+ r'(?:["\']?[A-Za-z0-9+\/]{86,88 }==["\']?)' ,
3233 ),
3334 ]
3435
3536 context_keys = [
36- r'{account_key}=\s* {secret}' ,
37+ r'(?i) {account_key}[\s=]{{1,20}} {secret}' ,
3738
3839 # maximum 2 lines secret distance under azure mention (case-insensitive)
3940 r'(?i)\b{azure}(.*\n){{0,2}}.*{secret}' ,
@@ -89,7 +90,7 @@ def context_keys_exists(self, result: PotentialSecret, string: str) -> bool:
8990 azure = self .azure ,
9091 ), re .MULTILINE ,
9192 )
92- if regex . pattern . startswith ( self .account_key ) and self . account_key not in string :
93+ if self .account_key in regex . pattern and not self . account_key_check . search ( string ) :
9394 continue
9495 if self .azure in regex .pattern .lower () and self .azure not in string .lower ():
9596 continue
0 commit comments