socketdev 3.0.6__tar.gz → 3.0.13__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {socketdev-3.0.6 → socketdev-3.0.13}/.github/workflows/pr-preview.yml +6 -6
- {socketdev-3.0.6 → socketdev-3.0.13}/.github/workflows/release.yml +4 -4
- {socketdev-3.0.6 → socketdev-3.0.13}/.github/workflows/version-check.yml +3 -3
- {socketdev-3.0.6 → socketdev-3.0.13}/.gitignore +2 -1
- {socketdev-3.0.6 → socketdev-3.0.13}/PKG-INFO +41 -1
- {socketdev-3.0.6 → socketdev-3.0.13}/README.rst +40 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/pyproject.toml +1 -1
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/__init__.py +2 -0
- socketdev-3.0.13/socketdev/basics/__init__.py +120 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/core/dedupe.py +16 -8
- socketdev-3.0.13/socketdev/version.py +1 -0
- socketdev-3.0.6/socketdev/version.py +0 -1
- {socketdev-3.0.6 → socketdev-3.0.13}/.github/CODEOWNERS +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/.github/PULL_REQUEST_TEMPLATE/bug-fix.md +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/.github/PULL_REQUEST_TEMPLATE/improvement.md +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/.hooks/sync_version.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/.python-version +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/LICENSE +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/scripts/build.sh +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/scripts/deploy-test-pypi.sh +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/alerttypes/__init__.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/analytics/__init__.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/apitokens/__init__.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/auditlog/__init__.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/core/api.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/core/classes.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/core/issues.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/dependencies/__init__.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/diffscans/__init__.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/exceptions.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/export/__init__.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/fullscans/__init__.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/historical/__init__.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/labels/__init__.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/licensemetadata/__init__.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/log.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/npm/__init__.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/openapi/__init__.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/org/__init__.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/purl/__init__.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/quota/__init__.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/report/__init__.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/repos/__init__.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/repositories/__init__.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/sbom/__init__.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/settings/__init__.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/threatfeed/__init__.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/tools/__init__.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/triage/__init__.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/socketdev/utils/__init__.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/tests/README.md +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/tests/conftest.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/tests/integration/test_all_endpoints.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/tests/integration/test_comprehensive_integration.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/tests/integration/test_diffscans_integration.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/tests/integration/test_new_endpoints.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/tests/run_tests.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/tests/unit/__init__.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/tests/unit/test_all_endpoints_unit.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/tests/unit/test_dedupe.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/tests/unit/test_socket_sdk_unit.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/tests/unit/test_working_endpoints_unit.py +0 -0
- {socketdev-3.0.6 → socketdev-3.0.13}/uv.lock +0 -0
|
@@ -11,10 +11,10 @@ jobs:
|
|
|
11
11
|
contents: read
|
|
12
12
|
pull-requests: write
|
|
13
13
|
steps:
|
|
14
|
-
- uses: actions/checkout@
|
|
14
|
+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
|
|
15
15
|
with:
|
|
16
16
|
fetch-depth: 0
|
|
17
|
-
- uses: actions/setup-python@
|
|
17
|
+
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3
|
|
18
18
|
with:
|
|
19
19
|
python-version: '3.x'
|
|
20
20
|
|
|
@@ -57,14 +57,14 @@ jobs:
|
|
|
57
57
|
|
|
58
58
|
- name: Publish to Test PyPI
|
|
59
59
|
if: steps.version_check.outputs.exists != 'true'
|
|
60
|
-
uses: pypa/gh-action-pypi-publish@
|
|
60
|
+
uses: pypa/gh-action-pypi-publish@ab69e431e9c9f48a3310be0a56527c679f56e04d
|
|
61
61
|
with:
|
|
62
62
|
repository-url: https://test.pypi.org/legacy/
|
|
63
63
|
verbose: true
|
|
64
64
|
|
|
65
65
|
- name: Comment on PR
|
|
66
66
|
if: steps.version_check.outputs.exists != 'true'
|
|
67
|
-
uses: actions/github-script@
|
|
67
|
+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
|
|
68
68
|
env:
|
|
69
69
|
VERSION: ${{ env.VERSION }}
|
|
70
70
|
with:
|
|
@@ -118,7 +118,7 @@ jobs:
|
|
|
118
118
|
VERSION: ${{ env.VERSION }}
|
|
119
119
|
run: |
|
|
120
120
|
for i in {1..30}; do
|
|
121
|
-
if pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple socketdev==${VERSION}; then
|
|
121
|
+
if pip install --index-url 'https://test.pypi.org/simple/' --extra-index-url 'https://pypi.org/simple' socketdev==${VERSION}; then
|
|
122
122
|
echo "Package ${VERSION} is now available and installable on Test PyPI"
|
|
123
123
|
pip uninstall -y socketdev
|
|
124
124
|
echo "success=true" >> $GITHUB_OUTPUT
|
|
@@ -128,4 +128,4 @@ jobs:
|
|
|
128
128
|
sleep 20
|
|
129
129
|
done
|
|
130
130
|
echo "success=false" >> $GITHUB_OUTPUT
|
|
131
|
-
exit 1
|
|
131
|
+
exit 1
|
|
@@ -10,10 +10,10 @@ jobs:
|
|
|
10
10
|
id-token: write
|
|
11
11
|
contents: read
|
|
12
12
|
steps:
|
|
13
|
-
- uses: actions/checkout@
|
|
13
|
+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
|
|
14
14
|
with:
|
|
15
15
|
fetch-depth: 0
|
|
16
|
-
- uses: actions/setup-python@
|
|
16
|
+
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3
|
|
17
17
|
with:
|
|
18
18
|
python-version: '3.x'
|
|
19
19
|
|
|
@@ -54,7 +54,7 @@ jobs:
|
|
|
54
54
|
|
|
55
55
|
- name: Publish to PyPI
|
|
56
56
|
if: steps.version_check.outputs.pypi_exists != 'true'
|
|
57
|
-
uses: pypa/gh-action-pypi-publish@
|
|
57
|
+
uses: pypa/gh-action-pypi-publish@ab69e431e9c9f48a3310be0a56527c679f56e04d
|
|
58
58
|
|
|
59
59
|
- name: Verify package is installable
|
|
60
60
|
id: verify_package
|
|
@@ -72,4 +72,4 @@ jobs:
|
|
|
72
72
|
sleep 20
|
|
73
73
|
done
|
|
74
74
|
echo "success=false" >> $GITHUB_OUTPUT
|
|
75
|
-
exit 1
|
|
75
|
+
exit 1
|
|
@@ -11,7 +11,7 @@ jobs:
|
|
|
11
11
|
check_version:
|
|
12
12
|
runs-on: ubuntu-latest
|
|
13
13
|
steps:
|
|
14
|
-
- uses: actions/checkout@
|
|
14
|
+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
|
|
15
15
|
with:
|
|
16
16
|
fetch-depth: 0 # Fetch all history for all branches
|
|
17
17
|
|
|
@@ -39,7 +39,7 @@ jobs:
|
|
|
39
39
|
"
|
|
40
40
|
|
|
41
41
|
- name: Manage PR Comment
|
|
42
|
-
uses: actions/github-script@
|
|
42
|
+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
|
|
43
43
|
if: always()
|
|
44
44
|
env:
|
|
45
45
|
MAIN_VERSION: ${{ env.MAIN_VERSION }}
|
|
@@ -87,4 +87,4 @@ jobs:
|
|
|
87
87
|
issue_number: prNumber,
|
|
88
88
|
body: `❌ **Version Check Failed**\n\nPlease increment...`
|
|
89
89
|
});
|
|
90
|
-
}
|
|
90
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: socketdev
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.13
|
|
4
4
|
Summary: Socket Security Python SDK
|
|
5
5
|
Project-URL: Homepage, https://github.com/socketdev/socketdev
|
|
6
6
|
Author-email: Douglas Coburn <douglas@socket.dev>
|
|
@@ -355,6 +355,46 @@ Get GitHub Flavored Markdown diff between two full scans.
|
|
|
355
355
|
- **before (str)** - The base full scan ID
|
|
356
356
|
- **after (str)** - The comparison full scan ID
|
|
357
357
|
|
|
358
|
+
basics.get_config(org_slug, use_types)
|
|
359
|
+
""""""""""""""""""""""""""""""""""""""
|
|
360
|
+
Get Socket Basics configuration for an organization. Socket Basics is a CI/CD security scanning suite that includes SAST scanning, secret detection, container security, and dependency analysis.
|
|
361
|
+
|
|
362
|
+
**Usage:**
|
|
363
|
+
|
|
364
|
+
.. code-block:: python
|
|
365
|
+
|
|
366
|
+
from socketdev import socketdev
|
|
367
|
+
socket = socketdev(token="REPLACE_ME")
|
|
368
|
+
|
|
369
|
+
# Basic usage - returns dictionary
|
|
370
|
+
config = socket.basics.get_config("org_slug")
|
|
371
|
+
print(f"Python SAST enabled: {config['pythonSastEnabled']}")
|
|
372
|
+
print(f"Secret scanning enabled: {config['secretScanningEnabled']}")
|
|
373
|
+
|
|
374
|
+
# Using typed response objects
|
|
375
|
+
from socketdev.basics import SocketBasicsConfig, SocketBasicsResponse
|
|
376
|
+
response = socket.basics.get_config("org_slug", use_types=True)
|
|
377
|
+
if response.success and response.config:
|
|
378
|
+
print(f"JavaScript SAST: {response.config.javascriptSastEnabled}")
|
|
379
|
+
print(f"Trivy scanning: {response.config.trivyImageEnabled}")
|
|
380
|
+
|
|
381
|
+
**PARAMETERS:**
|
|
382
|
+
|
|
383
|
+
- **org_slug (str)** - The organization name
|
|
384
|
+
- **use_types (bool)** - Whether to return typed response objects (default: False)
|
|
385
|
+
|
|
386
|
+
**Socket Basics Features:**
|
|
387
|
+
|
|
388
|
+
- **Python SAST** - Static analysis for Python code
|
|
389
|
+
- **Go SAST** - Static analysis for Go code
|
|
390
|
+
- **JavaScript SAST** - Static analysis for JavaScript/TypeScript code
|
|
391
|
+
- **Secret Scanning** - Detection of hardcoded secrets and credentials
|
|
392
|
+
- **Trivy Image Scanning** - Vulnerability scanning for Docker images
|
|
393
|
+
- **Trivy Dockerfile Scanning** - Vulnerability scanning for Dockerfiles
|
|
394
|
+
- **Socket SCA** - Supply chain analysis for dependencies
|
|
395
|
+
- **Socket Scanning** - General dependency security scanning
|
|
396
|
+
- **Additional Parameters** - Custom configuration options
|
|
397
|
+
|
|
358
398
|
dependencies.get(limit, offset)
|
|
359
399
|
"""""""""""""""""""""""""""""""
|
|
360
400
|
Retrieve the dependencies for the organization associated with the API Key
|
|
@@ -304,6 +304,46 @@ Get GitHub Flavored Markdown diff between two full scans.
|
|
|
304
304
|
- **before (str)** - The base full scan ID
|
|
305
305
|
- **after (str)** - The comparison full scan ID
|
|
306
306
|
|
|
307
|
+
basics.get_config(org_slug, use_types)
|
|
308
|
+
""""""""""""""""""""""""""""""""""""""
|
|
309
|
+
Get Socket Basics configuration for an organization. Socket Basics is a CI/CD security scanning suite that includes SAST scanning, secret detection, container security, and dependency analysis.
|
|
310
|
+
|
|
311
|
+
**Usage:**
|
|
312
|
+
|
|
313
|
+
.. code-block:: python
|
|
314
|
+
|
|
315
|
+
from socketdev import socketdev
|
|
316
|
+
socket = socketdev(token="REPLACE_ME")
|
|
317
|
+
|
|
318
|
+
# Basic usage - returns dictionary
|
|
319
|
+
config = socket.basics.get_config("org_slug")
|
|
320
|
+
print(f"Python SAST enabled: {config['pythonSastEnabled']}")
|
|
321
|
+
print(f"Secret scanning enabled: {config['secretScanningEnabled']}")
|
|
322
|
+
|
|
323
|
+
# Using typed response objects
|
|
324
|
+
from socketdev.basics import SocketBasicsConfig, SocketBasicsResponse
|
|
325
|
+
response = socket.basics.get_config("org_slug", use_types=True)
|
|
326
|
+
if response.success and response.config:
|
|
327
|
+
print(f"JavaScript SAST: {response.config.javascriptSastEnabled}")
|
|
328
|
+
print(f"Trivy scanning: {response.config.trivyImageEnabled}")
|
|
329
|
+
|
|
330
|
+
**PARAMETERS:**
|
|
331
|
+
|
|
332
|
+
- **org_slug (str)** - The organization name
|
|
333
|
+
- **use_types (bool)** - Whether to return typed response objects (default: False)
|
|
334
|
+
|
|
335
|
+
**Socket Basics Features:**
|
|
336
|
+
|
|
337
|
+
- **Python SAST** - Static analysis for Python code
|
|
338
|
+
- **Go SAST** - Static analysis for Go code
|
|
339
|
+
- **JavaScript SAST** - Static analysis for JavaScript/TypeScript code
|
|
340
|
+
- **Secret Scanning** - Detection of hardcoded secrets and credentials
|
|
341
|
+
- **Trivy Image Scanning** - Vulnerability scanning for Docker images
|
|
342
|
+
- **Trivy Dockerfile Scanning** - Vulnerability scanning for Dockerfiles
|
|
343
|
+
- **Socket SCA** - Supply chain analysis for dependencies
|
|
344
|
+
- **Socket Scanning** - General dependency security scanning
|
|
345
|
+
- **Additional Parameters** - Custom configuration options
|
|
346
|
+
|
|
307
347
|
dependencies.get(limit, offset)
|
|
308
348
|
"""""""""""""""""""""""""""""""
|
|
309
349
|
Retrieve the dependencies for the organization associated with the API Key
|
|
@@ -24,6 +24,7 @@ from socketdev.apitokens import ApiTokens
|
|
|
24
24
|
from socketdev.auditlog import AuditLog
|
|
25
25
|
from socketdev.analytics import Analytics
|
|
26
26
|
from socketdev.alerttypes import AlertTypes
|
|
27
|
+
from socketdev.basics import Basics
|
|
27
28
|
from socketdev.log import log
|
|
28
29
|
|
|
29
30
|
__author__ = "socket.dev"
|
|
@@ -72,6 +73,7 @@ class socketdev:
|
|
|
72
73
|
self.auditlog = AuditLog(self.api)
|
|
73
74
|
self.analytics = Analytics(self.api)
|
|
74
75
|
self.alerttypes = AlertTypes(self.api)
|
|
76
|
+
self.basics = Basics(self.api)
|
|
75
77
|
|
|
76
78
|
@staticmethod
|
|
77
79
|
def set_timeout(timeout: int):
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from typing import Optional, Union
|
|
3
|
+
from dataclasses import dataclass, asdict
|
|
4
|
+
|
|
5
|
+
log = logging.getLogger("socketdev")
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass
|
|
9
|
+
class SocketBasicsConfig:
|
|
10
|
+
"""Data class representing Socket Basics configuration settings."""
|
|
11
|
+
pythonSastEnabled: bool = False
|
|
12
|
+
golangSastEnabled: bool = False
|
|
13
|
+
javascriptSastEnabled: bool = False
|
|
14
|
+
secretScanningEnabled: bool = False
|
|
15
|
+
trivyImageEnabled: bool = False
|
|
16
|
+
trivyDockerfileEnabled: bool = False
|
|
17
|
+
socketScanningEnabled: bool = False
|
|
18
|
+
socketScaEnabled: bool = False
|
|
19
|
+
additionalParameters: str = ""
|
|
20
|
+
|
|
21
|
+
def __getitem__(self, key):
|
|
22
|
+
return getattr(self, key)
|
|
23
|
+
|
|
24
|
+
def to_dict(self):
|
|
25
|
+
return asdict(self)
|
|
26
|
+
|
|
27
|
+
@classmethod
|
|
28
|
+
def from_dict(cls, data: dict) -> "SocketBasicsConfig":
|
|
29
|
+
return cls(
|
|
30
|
+
pythonSastEnabled=data.get("pythonSastEnabled", False),
|
|
31
|
+
golangSastEnabled=data.get("golangSastEnabled", False),
|
|
32
|
+
javascriptSastEnabled=data.get("javascriptSastEnabled", False),
|
|
33
|
+
secretScanningEnabled=data.get("secretScanningEnabled", False),
|
|
34
|
+
trivyImageEnabled=data.get("trivyImageEnabled", False),
|
|
35
|
+
trivyDockerfileEnabled=data.get("trivyDockerfileEnabled", False),
|
|
36
|
+
socketScanningEnabled=data.get("socketScanningEnabled", False),
|
|
37
|
+
socketScaEnabled=data.get("socketScaEnabled", False),
|
|
38
|
+
additionalParameters=data.get("additionalParameters", ""),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@dataclass
|
|
43
|
+
class SocketBasicsResponse:
|
|
44
|
+
"""Data class representing the response from Socket Basics API calls."""
|
|
45
|
+
success: bool
|
|
46
|
+
status: int
|
|
47
|
+
config: Optional[SocketBasicsConfig] = None
|
|
48
|
+
message: Optional[str] = None
|
|
49
|
+
|
|
50
|
+
def __getitem__(self, key):
|
|
51
|
+
return getattr(self, key)
|
|
52
|
+
|
|
53
|
+
def to_dict(self):
|
|
54
|
+
return asdict(self)
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def from_dict(cls, data: dict) -> "SocketBasicsResponse":
|
|
58
|
+
return cls(
|
|
59
|
+
config=SocketBasicsConfig.from_dict(data) if data else None,
|
|
60
|
+
success=True,
|
|
61
|
+
status=200,
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class Basics:
|
|
66
|
+
"""
|
|
67
|
+
Socket Basics API client for managing CI/CD security scanning configurations.
|
|
68
|
+
|
|
69
|
+
Socket Basics is a security scanning suite that includes:
|
|
70
|
+
- SAST (Static Application Security Testing) for Python, Go, and JavaScript
|
|
71
|
+
- Secret scanning for hardcoded credentials
|
|
72
|
+
- Container security for Docker images and Dockerfiles
|
|
73
|
+
- Socket SCA dependency scanning
|
|
74
|
+
"""
|
|
75
|
+
|
|
76
|
+
def __init__(self, api):
|
|
77
|
+
self.api = api
|
|
78
|
+
|
|
79
|
+
def get_config(
|
|
80
|
+
self, org_slug: str, use_types: bool = False
|
|
81
|
+
) -> Union[dict, SocketBasicsResponse]:
|
|
82
|
+
"""
|
|
83
|
+
Get Socket Basics configuration for an organization.
|
|
84
|
+
|
|
85
|
+
Args:
|
|
86
|
+
org_slug: Organization slug
|
|
87
|
+
use_types: Whether to return typed response objects (default: False)
|
|
88
|
+
|
|
89
|
+
Returns:
|
|
90
|
+
dict or SocketBasicsResponse: Configuration settings for Socket Basics
|
|
91
|
+
|
|
92
|
+
Example:
|
|
93
|
+
>>> basics = socketdev_client.basics
|
|
94
|
+
>>> config = basics.get_config("my-org")
|
|
95
|
+
>>> print(config["pythonSastEnabled"])
|
|
96
|
+
|
|
97
|
+
>>> # Using typed response
|
|
98
|
+
>>> response = basics.get_config("my-org", use_types=True)
|
|
99
|
+
>>> print(response.config.pythonSastEnabled)
|
|
100
|
+
"""
|
|
101
|
+
path = f"orgs/{org_slug}/settings/socket-basics"
|
|
102
|
+
response = self.api.do_request(path=path, method="GET")
|
|
103
|
+
|
|
104
|
+
if response.status_code == 200:
|
|
105
|
+
config_data = response.json()
|
|
106
|
+
if use_types:
|
|
107
|
+
return SocketBasicsResponse.from_dict(config_data)
|
|
108
|
+
return config_data
|
|
109
|
+
|
|
110
|
+
error_message = response.json().get("error", {}).get("message", "Unknown error")
|
|
111
|
+
log.error(f"Failed to get Socket Basics configuration: {response.status_code}, message: {error_message}")
|
|
112
|
+
|
|
113
|
+
if use_types:
|
|
114
|
+
return SocketBasicsResponse(
|
|
115
|
+
success=False,
|
|
116
|
+
status=response.status_code,
|
|
117
|
+
config=None,
|
|
118
|
+
message=error_message
|
|
119
|
+
)
|
|
120
|
+
return {}
|
|
@@ -13,7 +13,7 @@ class Dedupe:
|
|
|
13
13
|
return (
|
|
14
14
|
alert["type"],
|
|
15
15
|
alert["severity"],
|
|
16
|
-
alert
|
|
16
|
+
alert.get("category"),
|
|
17
17
|
Dedupe.normalize_file_path(alert.get("file")),
|
|
18
18
|
alert.get("start"),
|
|
19
19
|
alert.get("end")
|
|
@@ -25,7 +25,7 @@ class Dedupe:
|
|
|
25
25
|
return (
|
|
26
26
|
alert["type"],
|
|
27
27
|
alert["severity"],
|
|
28
|
-
alert
|
|
28
|
+
alert.get("category"),
|
|
29
29
|
Dedupe.normalize_file_path(alert.get("file")),
|
|
30
30
|
alert.get("start"),
|
|
31
31
|
alert.get("end")
|
|
@@ -39,21 +39,29 @@ class Dedupe:
|
|
|
39
39
|
|
|
40
40
|
for alert in pkg.get("alerts", []):
|
|
41
41
|
identity = alert_identity(alert)
|
|
42
|
-
file = Dedupe.normalize_file_path(alert.get("file"))
|
|
43
42
|
|
|
44
43
|
if identity not in alert_map:
|
|
45
|
-
|
|
44
|
+
# Build alert dict with only fields that exist in the original alert
|
|
45
|
+
consolidated_alert = {
|
|
46
46
|
"key": alert["key"], # keep the first key seen
|
|
47
47
|
"type": alert["type"],
|
|
48
48
|
"severity": alert["severity"],
|
|
49
|
-
"category": alert["category"],
|
|
50
|
-
"file": file,
|
|
51
|
-
"start": alert.get("start"),
|
|
52
|
-
"end": alert.get("end"),
|
|
53
49
|
"releases": [release],
|
|
54
50
|
"props": alert.get("props", []),
|
|
55
51
|
"action": alert["action"]
|
|
56
52
|
}
|
|
53
|
+
|
|
54
|
+
# Only include optional fields if they exist in the original alert
|
|
55
|
+
if "category" in alert:
|
|
56
|
+
consolidated_alert["category"] = alert["category"]
|
|
57
|
+
if "file" in alert:
|
|
58
|
+
consolidated_alert["file"] = Dedupe.normalize_file_path(alert["file"])
|
|
59
|
+
if "start" in alert:
|
|
60
|
+
consolidated_alert["start"] = alert["start"]
|
|
61
|
+
if "end" in alert:
|
|
62
|
+
consolidated_alert["end"] = alert["end"]
|
|
63
|
+
|
|
64
|
+
alert_map[identity] = consolidated_alert
|
|
57
65
|
else:
|
|
58
66
|
if release not in alert_map[identity]["releases"]:
|
|
59
67
|
alert_map[identity]["releases"].append(release)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "3.0.13"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "3.0.6"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|