Skip to content

Commit dec7cf9

Browse files
authored
fix Azure regex (#276)
1 parent 0fdd3e0 commit dec7cf9

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

detect_secrets/plugins/azure_storage_key.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class AzureStorageKeyDetector(RegexBasedDetector):
2323

2424
max_line_length = 4000
2525
max_part_length = 2000
26-
integrity_regex = re.compile(r'integrity[:=]|sha256|sha384|sha512')
26+
integrity_regex = re.compile(r'integrity[:=]|sha256|sha384|sha512|cosmos|master')
2727

2828
denylist = [
2929
# Account Key (AccountKey=xxxxxxxxx)

tests/plugins/azure_storage_key_test.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,26 @@ class TestAzureStorageKeyDetector:
215215
""",
216216
False,
217217
),
218+
(
219+
'CosmosKey=lJzRc1YdHaAA2KCNJJ1tkYwF/+mKK6Ygw0NGe170Xu592euJv2wYUtBlV8z+qnlcNQSnIYVTkLWntUO1F8j8rQ==',
220+
False,
221+
),
222+
(
223+
"""
224+
cosmos = lJzRc1YdHaAA2KCNJJ1tkYwF/+mKK6Ygw0NGe170Xu592euJv2wYUtBlV8z+qnlcNQSnIYVTkLWntUO1F8j8rQ==
225+
Azure.com +WITH IDENTITY = 'IDENTITY'
226+
""",
227+
False,
228+
),
229+
(
230+
"""
231+
settings = {
232+
'host': os.environ.get('ACCOUNT_HOST', 'https://cosmosdb-account-r4b3whg3f2qw4.documents.azure.com:443/'),
233+
'master_key': os.environ.get('ACCOUNT_KEY', 'H0maE9FWji2oHBsj9tuj5FREJRQGXRTIAJ3fA3CS46IGK3UcjeKy1DCFHNDt4oj4nq4Bh8YYujpuAFDddR5atw=='),
234+
}
235+
""",
236+
False,
237+
),
218238
],
219239
)
220240
def test_analyze(self, payload, should_flag):

0 commit comments

Comments
 (0)