File tree 3 files changed +41
-0
lines changed 3 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -499,6 +499,12 @@ class PluginOptions:
499
499
help_text = 'Disables scans for Square OAuth tokens.' ,
500
500
filename = 'square_oauth' ,
501
501
),
502
+ PluginDescriptor (
503
+ classname = 'AzureStorageKeyDetector' ,
504
+ flag_text = '--no-azure-storage-scan' ,
505
+ help_text = 'Disables scans for Azure Storage Account access.' ,
506
+ filename = 'azure_storage_key' ,
507
+ ),
502
508
]
503
509
opt_in_plugins = [
504
510
PluginDescriptor (
Original file line number Diff line number Diff line change
1
+ """
2
+ This plugin searches for Azure Storage Account access keys.
3
+ """
4
+ import re
5
+
6
+ from detect_secrets .plugins .base import RegexBasedDetector
7
+
8
+
9
+ class AzureStorageKeyDetector (RegexBasedDetector ):
10
+ """Scans for Azure Storage Account access keys."""
11
+ secret_type = 'Azure Storage Account access key'
12
+
13
+ denylist = [
14
+ # Account Key (AccountKey=xxxxxxxxx)
15
+ re .compile (r'AccountKey=[a-zA-Z0-9+\/=]{88}' ),
16
+ ]
Original file line number Diff line number Diff line change
1
+ import pytest
2
+
3
+ from detect_secrets .plugins .azure_storage_key import AzureStorageKeyDetector
4
+
5
+
6
+ class TestAzureStorageKeyDetector :
7
+
8
+ @pytest .mark .parametrize (
9
+ 'payload, should_flag' ,
10
+ [
11
+ (
12
+ 'AccountKey=lJzRc1YdHaAA2KCNJJ1tkYwF/+mKK6Ygw0NGe170Xu592euJv2wYUtBlV8z+qnlcNQSnIYVTkLWntUO1F8j8rQ==' , # noqa: E501
13
+ True ,
14
+ ),
15
+ ],
16
+ )
17
+ def test_analyze (self , payload , should_flag ):
18
+ logic = AzureStorageKeyDetector ()
19
+ assert logic .analyze_line (payload , 1 , 'mock_filename' )
You can’t perform that action at this time.
0 commit comments