File tree Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -493,6 +493,12 @@ class PluginOptions:
493
493
help_text = 'Disables scans for NPM keys.' ,
494
494
filename = 'npm' ,
495
495
),
496
+ PluginDescriptor (
497
+ classname = 'SquareOAuthDetector' ,
498
+ flag_text = '--no-square-oauth' ,
499
+ help_text = 'Disables scans for Square OAuth tokens.' ,
500
+ filename = 'square_oauth' ,
501
+ ),
496
502
PluginDescriptor (
497
503
classname = 'AzureStorageKeyDetector' ,
498
504
flag_text = '--no-azure-storage-scan' ,
Original file line number Diff line number Diff line change
1
+ import re
2
+
3
+ from detect_secrets .plugins .base import RegexBasedDetector
4
+
5
+
6
+ class SquareOAuthDetector (RegexBasedDetector ):
7
+ """Scans for Square OAuth Secrets"""
8
+ secret_type = 'Square OAuth Secret'
9
+
10
+ denylist = [
11
+ re .compile (r'sq0csp-[0-9A-Za-z\\\-_]{43}' ),
12
+ ]
Original file line number Diff line number Diff line change
1
+ import pytest
2
+
3
+ from detect_secrets .plugins .square_oauth import SquareOAuthDetector
4
+
5
+
6
+ class TestSquareOauthDetector :
7
+
8
+ @pytest .mark .parametrize (
9
+ 'payload' ,
10
+ (
11
+ 'square_oauth = sq0csp-ABCDEFGHIJK_LMNOPQRSTUVWXYZ-0123456789\\ abcd' ,
12
+ ),
13
+ )
14
+ def test_analyze (self , payload ):
15
+ logic = SquareOAuthDetector ()
16
+ assert logic .analyze_line (payload , 1 , 'mock_filename' )
You can’t perform that action at this time.
0 commit comments