Skip to content

Commit ba395dc

Browse files
author
Shamil Patel
committed
Merge branch 'master' of github.com:IBM/detect-secrets into port-azure-storage
2 parents 0360c23 + 53b296b commit ba395dc

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

detect_secrets/core/usage.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,12 @@ class PluginOptions:
493493
help_text='Disables scans for NPM keys.',
494494
filename='npm',
495495
),
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+
),
496502
PluginDescriptor(
497503
classname='AzureStorageKeyDetector',
498504
flag_text='--no-azure-storage-scan',
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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+
]

tests/plugins/square_oauth_test.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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')

0 commit comments

Comments
 (0)