socketdev 3.0.24__tar.gz → 3.0.28__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.
Files changed (73) hide show
  1. {socketdev-3.0.24 → socketdev-3.0.28}/PKG-INFO +318 -1
  2. {socketdev-3.0.24 → socketdev-3.0.28}/README.rst +317 -0
  3. {socketdev-3.0.24 → socketdev-3.0.28}/pyproject.toml +1 -1
  4. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/__init__.py +3 -1
  5. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/core/api.py +6 -1
  6. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/fullscans/__init__.py +9 -1
  7. socketdev-3.0.28/socketdev/version.py +1 -0
  8. socketdev-3.0.24/socketdev/version.py +0 -1
  9. {socketdev-3.0.24 → socketdev-3.0.28}/.github/CODEOWNERS +0 -0
  10. {socketdev-3.0.24 → socketdev-3.0.28}/.github/PULL_REQUEST_TEMPLATE/bug-fix.md +0 -0
  11. {socketdev-3.0.24 → socketdev-3.0.28}/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -0
  12. {socketdev-3.0.24 → socketdev-3.0.28}/.github/PULL_REQUEST_TEMPLATE/improvement.md +0 -0
  13. {socketdev-3.0.24 → socketdev-3.0.28}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  14. {socketdev-3.0.24 → socketdev-3.0.28}/.github/workflows/pr-preview.yml +0 -0
  15. {socketdev-3.0.24 → socketdev-3.0.28}/.github/workflows/release.yml +0 -0
  16. {socketdev-3.0.24 → socketdev-3.0.28}/.github/workflows/version-check.yml +0 -0
  17. {socketdev-3.0.24 → socketdev-3.0.28}/.gitignore +0 -0
  18. {socketdev-3.0.24 → socketdev-3.0.28}/.hooks/sync_version.py +0 -0
  19. {socketdev-3.0.24 → socketdev-3.0.28}/.python-version +0 -0
  20. {socketdev-3.0.24 → socketdev-3.0.28}/LICENSE +0 -0
  21. {socketdev-3.0.24 → socketdev-3.0.28}/scripts/build.sh +0 -0
  22. {socketdev-3.0.24 → socketdev-3.0.28}/scripts/deploy-test-pypi.sh +0 -0
  23. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/alertfullscansearch/__init__.py +0 -0
  24. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/alerts/__init__.py +0 -0
  25. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/alerttypes/__init__.py +0 -0
  26. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/analytics/__init__.py +0 -0
  27. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/apitokens/__init__.py +0 -0
  28. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/auditlog/__init__.py +0 -0
  29. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/basics/__init__.py +0 -0
  30. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/core/classes.py +0 -0
  31. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/core/dedupe.py +0 -0
  32. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/core/issues.py +0 -0
  33. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/dependencies/__init__.py +0 -0
  34. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/diffscans/__init__.py +0 -0
  35. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/exceptions.py +0 -0
  36. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/export/__init__.py +0 -0
  37. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/fixes/__init__.py +0 -0
  38. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/historical/__init__.py +0 -0
  39. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/labels/__init__.py +0 -0
  40. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/licensemetadata/__init__.py +0 -0
  41. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/log.py +0 -0
  42. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/npm/__init__.py +0 -0
  43. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/openapi/__init__.py +0 -0
  44. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/org/__init__.py +0 -0
  45. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/purl/__init__.py +0 -0
  46. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/quota/__init__.py +0 -0
  47. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/report/__init__.py +0 -0
  48. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/repos/__init__.py +0 -0
  49. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/repositories/__init__.py +0 -0
  50. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/sbom/__init__.py +0 -0
  51. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/settings/__init__.py +0 -0
  52. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/supportedfiles/__init__.py +0 -0
  53. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/telemetry/__init__.py +0 -0
  54. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/threatfeed/__init__.py +0 -0
  55. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/tools/__init__.py +0 -0
  56. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/triage/__init__.py +0 -0
  57. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/uploadmanifests/__init__.py +0 -0
  58. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/utils/__init__.py +0 -0
  59. {socketdev-3.0.24 → socketdev-3.0.28}/socketdev/webhooks/__init__.py +0 -0
  60. {socketdev-3.0.24 → socketdev-3.0.28}/tests/README.md +0 -0
  61. {socketdev-3.0.24 → socketdev-3.0.28}/tests/conftest.py +0 -0
  62. {socketdev-3.0.24 → socketdev-3.0.28}/tests/integration/test_all_endpoints.py +0 -0
  63. {socketdev-3.0.24 → socketdev-3.0.28}/tests/integration/test_comprehensive_integration.py +0 -0
  64. {socketdev-3.0.24 → socketdev-3.0.28}/tests/integration/test_diffscans_integration.py +0 -0
  65. {socketdev-3.0.24 → socketdev-3.0.28}/tests/integration/test_new_endpoints.py +0 -0
  66. {socketdev-3.0.24 → socketdev-3.0.28}/tests/run_tests.py +0 -0
  67. {socketdev-3.0.24 → socketdev-3.0.28}/tests/unit/__init__.py +0 -0
  68. {socketdev-3.0.24 → socketdev-3.0.28}/tests/unit/test_all_endpoints_unit.py +0 -0
  69. {socketdev-3.0.24 → socketdev-3.0.28}/tests/unit/test_dedupe.py +0 -0
  70. {socketdev-3.0.24 → socketdev-3.0.28}/tests/unit/test_socket_sdk_unit.py +0 -0
  71. {socketdev-3.0.24 → socketdev-3.0.28}/tests/unit/test_upload_manifests.py +0 -0
  72. {socketdev-3.0.24 → socketdev-3.0.28}/tests/unit/test_working_endpoints_unit.py +0 -0
  73. {socketdev-3.0.24 → socketdev-3.0.28}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: socketdev
3
- Version: 3.0.24
3
+ Version: 3.0.28
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>
@@ -73,6 +73,7 @@ Initializing the module
73
73
  - **token (str)** - The Socket API Key for your Organization
74
74
  - **timeout (int)** - The number of seconds to wait before failing the connection
75
75
  - **allow_unverified (bool)** - Whether to skip SSL certificate verification (default: False). Set to True for testing with self-signed certificates.
76
+ - **user_agent (str, optional)** - Custom User-Agent string to use in API requests. If not provided, defaults to "SocketSDKPython/{version}"
76
77
 
77
78
  Supported Functions
78
79
  -------------------
@@ -153,6 +154,35 @@ Export a Socket SBOM as an SPDX SBOM
153
154
 
154
155
  **PARAMETERS:**
155
156
 
157
+ - **org_slug (str)** - The organization name
158
+ - **id (str)** - The ID of either a full scan or an SBOM report
159
+ - **query_params (ExportQueryParams)** - Optional query parameters for filtering:
160
+ - **author (str)** - Filter by author
161
+ - **project_group (str)** - Filter by project group
162
+ - **project_name (str)** - Filter by project name
163
+ - **project_version (str)** - Filter by project version
164
+ - **project_id (str)** - Filter by project ID
165
+
166
+ export.openvex_bom(org_slug, id, query_params)
167
+ """"""""""""""""""""""""""""""""""""""""""""""
168
+ Export a Socket SBOM as an OpenVEX SBOM
169
+
170
+ **Usage:**
171
+
172
+ .. code-block:: python
173
+
174
+ from socketdev import socketdev
175
+ from socketdev.export import ExportQueryParams
176
+
177
+ socket = socketdev(token="REPLACE_ME")
178
+ query_params = ExportQueryParams(
179
+ project_name="my-project",
180
+ project_version="1.0.0"
181
+ )
182
+ print(socket.export.openvex_bom("org_slug", "sbom_id", query_params))
183
+
184
+ **PARAMETERS:**
185
+
156
186
  - **org_slug (str)** - The organization name
157
187
  - **id (str)** - The ID of either a full scan or an SBOM report
158
188
  - **query_params (ExportQueryParams)** - Optional query parameters for filtering:
@@ -356,6 +386,24 @@ Get GitHub Flavored Markdown diff between two full scans.
356
386
  - **before (str)** - The base full scan ID
357
387
  - **after (str)** - The comparison full scan ID
358
388
 
389
+ fullscans.finalize_tier1(full_scan_id, tier1_reachability_scan_id)
390
+ """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
391
+ Finalize a tier 1 reachability scan by associating it with a full scan.
392
+
393
+ **Usage:**
394
+
395
+ .. code-block:: python
396
+
397
+ from socketdev import socketdev
398
+ socket = socketdev(token="REPLACE_ME")
399
+ success = socket.fullscans.finalize_tier1("full_scan_id", "tier1_reachability_scan_id")
400
+ print(f"Finalization successful: {success}")
401
+
402
+ **PARAMETERS:**
403
+
404
+ - **full_scan_id (str)** - The ID of the full scan to associate with the tier 1 scan
405
+ - **tier1_reachability_scan_id (str)** - The tier 1 reachability scan ID from the facts file
406
+
359
407
  basics.get_config(org_slug, use_types)
360
408
  """"""""""""""""""""""""""""""""""""""
361
409
  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.
@@ -1208,3 +1256,272 @@ Retrieve the OpenAPI specification for the Socket API.
1208
1256
  **PARAMETERS:**
1209
1257
 
1210
1258
  None required.
1259
+
1260
+ webhooks.list(org_slug, \*\*query_params)
1261
+ """""""""""""""""""""""""""""""""""""""""""
1262
+ List all webhooks for an organization.
1263
+
1264
+ **Usage:**
1265
+
1266
+ .. code-block:: python
1267
+
1268
+ from socketdev import socketdev
1269
+ socket = socketdev(token="REPLACE_ME")
1270
+ print(socket.webhooks.list("org_slug"))
1271
+
1272
+ # With query parameters
1273
+ print(socket.webhooks.list("org_slug", limit=10, offset=0))
1274
+
1275
+ **PARAMETERS:**
1276
+
1277
+ - **org_slug (str)** - The organization slug
1278
+ - **query_params** - Optional query parameters for filtering
1279
+
1280
+ webhooks.create(org_slug, \*\*kwargs)
1281
+ """"""""""""""""""""""""""""""""""""""
1282
+ Create a new webhook for an organization.
1283
+
1284
+ **Usage:**
1285
+
1286
+ .. code-block:: python
1287
+
1288
+ from socketdev import socketdev
1289
+ socket = socketdev(token="REPLACE_ME")
1290
+ webhook_config = {
1291
+ "url": "https://example.com/webhook",
1292
+ "events": ["alert.created", "scan.completed"]
1293
+ }
1294
+ print(socket.webhooks.create("org_slug", **webhook_config))
1295
+
1296
+ **PARAMETERS:**
1297
+
1298
+ - **org_slug (str)** - The organization slug
1299
+ - **kwargs** - Webhook configuration parameters
1300
+
1301
+ webhooks.get(org_slug, webhook_id)
1302
+ """"""""""""""""""""""""""""""""""
1303
+ Get details for a specific webhook.
1304
+
1305
+ **Usage:**
1306
+
1307
+ .. code-block:: python
1308
+
1309
+ from socketdev import socketdev
1310
+ socket = socketdev(token="REPLACE_ME")
1311
+ print(socket.webhooks.get("org_slug", "webhook_id"))
1312
+
1313
+ **PARAMETERS:**
1314
+
1315
+ - **org_slug (str)** - The organization slug
1316
+ - **webhook_id (str)** - The webhook ID
1317
+
1318
+ webhooks.update(org_slug, webhook_id, \*\*kwargs)
1319
+ """""""""""""""""""""""""""""""""""""""""""""""""""
1320
+ Update an existing webhook.
1321
+
1322
+ **Usage:**
1323
+
1324
+ .. code-block:: python
1325
+
1326
+ from socketdev import socketdev
1327
+ socket = socketdev(token="REPLACE_ME")
1328
+ updates = {
1329
+ "url": "https://example.com/new-webhook",
1330
+ "events": ["alert.created"]
1331
+ }
1332
+ print(socket.webhooks.update("org_slug", "webhook_id", **updates))
1333
+
1334
+ **PARAMETERS:**
1335
+
1336
+ - **org_slug (str)** - The organization slug
1337
+ - **webhook_id (str)** - The webhook ID
1338
+ - **kwargs** - Webhook configuration parameters to update
1339
+
1340
+ webhooks.delete(org_slug, webhook_id)
1341
+ """""""""""""""""""""""""""""""""""""
1342
+ Delete a webhook.
1343
+
1344
+ **Usage:**
1345
+
1346
+ .. code-block:: python
1347
+
1348
+ from socketdev import socketdev
1349
+ socket = socketdev(token="REPLACE_ME")
1350
+ print(socket.webhooks.delete("org_slug", "webhook_id"))
1351
+
1352
+ **PARAMETERS:**
1353
+
1354
+ - **org_slug (str)** - The organization slug
1355
+ - **webhook_id (str)** - The webhook ID
1356
+
1357
+ telemetry.get_config(org_slug)
1358
+ """"""""""""""""""""""""""""""
1359
+ Get telemetry configuration for an organization.
1360
+
1361
+ **Usage:**
1362
+
1363
+ .. code-block:: python
1364
+
1365
+ from socketdev import socketdev
1366
+ socket = socketdev(token="REPLACE_ME")
1367
+ print(socket.telemetry.get_config("org_slug"))
1368
+
1369
+ **PARAMETERS:**
1370
+
1371
+ - **org_slug (str)** - The organization slug
1372
+
1373
+ telemetry.update_config(org_slug, \*\*kwargs)
1374
+ """"""""""""""""""""""""""""""""""""""""""""""
1375
+ Update telemetry configuration for an organization.
1376
+
1377
+ **Usage:**
1378
+
1379
+ .. code-block:: python
1380
+
1381
+ from socketdev import socketdev
1382
+ socket = socketdev(token="REPLACE_ME")
1383
+ config = {
1384
+ "enabled": True,
1385
+ "sampling_rate": 0.5
1386
+ }
1387
+ print(socket.telemetry.update_config("org_slug", **config))
1388
+
1389
+ **PARAMETERS:**
1390
+
1391
+ - **org_slug (str)** - The organization slug
1392
+ - **kwargs** - Configuration parameters to update
1393
+
1394
+ alerts.get(org_slug, \*\*query_params)
1395
+ """""""""""""""""""""""""""""""""""""""
1396
+ Get alerts for an organization.
1397
+
1398
+ **Usage:**
1399
+
1400
+ .. code-block:: python
1401
+
1402
+ from socketdev import socketdev
1403
+ socket = socketdev(token="REPLACE_ME")
1404
+ print(socket.alerts.get("org_slug"))
1405
+
1406
+ # With query parameters
1407
+ print(socket.alerts.get("org_slug", severity="high", limit=50))
1408
+
1409
+ **PARAMETERS:**
1410
+
1411
+ - **org_slug (str)** - The organization slug
1412
+ - **query_params** - Optional query parameters for filtering
1413
+
1414
+ fixes.get(org_slug, \*\*query_params)
1415
+ """"""""""""""""""""""""""""""""""""""
1416
+ Get available fixes for an organization.
1417
+
1418
+ **Usage:**
1419
+
1420
+ .. code-block:: python
1421
+
1422
+ from socketdev import socketdev
1423
+ socket = socketdev(token="REPLACE_ME")
1424
+ print(socket.fixes.get("org_slug"))
1425
+
1426
+ # With query parameters
1427
+ print(socket.fixes.get("org_slug", ecosystem="npm"))
1428
+
1429
+ **PARAMETERS:**
1430
+
1431
+ - **org_slug (str)** - The organization slug
1432
+ - **query_params** - Optional query parameters for filtering
1433
+
1434
+ supportedfiles.get(org_slug)
1435
+ """"""""""""""""""""""""""""
1436
+ Get list of supported manifest file types for an organization.
1437
+
1438
+ **Usage:**
1439
+
1440
+ .. code-block:: python
1441
+
1442
+ from socketdev import socketdev
1443
+ socket = socketdev(token="REPLACE_ME")
1444
+ print(socket.supportedfiles.get("org_slug"))
1445
+
1446
+ **PARAMETERS:**
1447
+
1448
+ - **org_slug (str)** - The organization slug
1449
+
1450
+ alertfullscansearch.search(org_slug, \*\*query_params)
1451
+ """""""""""""""""""""""""""""""""""""""""""""""""""""""
1452
+ Search alerts across full scans.
1453
+
1454
+ **Usage:**
1455
+
1456
+ .. code-block:: python
1457
+
1458
+ from socketdev import socketdev
1459
+ socket = socketdev(token="REPLACE_ME")
1460
+ search_params = {
1461
+ "query": "CVE-2024-1234",
1462
+ "limit": 20
1463
+ }
1464
+ print(socket.alertfullscansearch.search("org_slug", **search_params))
1465
+
1466
+ **PARAMETERS:**
1467
+
1468
+ - **org_slug (str)** - The organization slug
1469
+ - **query_params** - Optional query parameters for filtering
1470
+
1471
+ historical.dependencies_trend(org_slug, query_params)
1472
+ """"""""""""""""""""""""""""""""""""""""""""""""""""""
1473
+ Get historical dependency trends data for an organization.
1474
+
1475
+ **Usage:**
1476
+
1477
+ .. code-block:: python
1478
+
1479
+ from socketdev import socketdev
1480
+ socket = socketdev(token="REPLACE_ME")
1481
+ query_params = {
1482
+ "from": "2024-01-01",
1483
+ "to": "2024-12-31"
1484
+ }
1485
+ print(socket.historical.dependencies_trend("org_slug", query_params))
1486
+
1487
+ **PARAMETERS:**
1488
+
1489
+ - **org_slug (str)** - The organization slug
1490
+ - **query_params (dict, optional)** - Optional query parameters for date filtering
1491
+
1492
+ historical.snapshots.create(org_slug)
1493
+ """""""""""""""""""""""""""""""""""""
1494
+ Create a new snapshot for an organization.
1495
+
1496
+ **Usage:**
1497
+
1498
+ .. code-block:: python
1499
+
1500
+ from socketdev import socketdev
1501
+ socket = socketdev(token="REPLACE_ME")
1502
+ print(socket.historical.snapshots.create("org_slug"))
1503
+
1504
+ **PARAMETERS:**
1505
+
1506
+ - **org_slug (str)** - The organization slug
1507
+
1508
+ historical.snapshots.list(org_slug, query_params)
1509
+ """""""""""""""""""""""""""""""""""""""""""""""""
1510
+ List historical snapshots for an organization.
1511
+
1512
+ **Usage:**
1513
+
1514
+ .. code-block:: python
1515
+
1516
+ from socketdev import socketdev
1517
+ socket = socketdev(token="REPLACE_ME")
1518
+ print(socket.historical.snapshots.list("org_slug"))
1519
+
1520
+ # With query parameters
1521
+ query_params = {"limit": 10, "offset": 0}
1522
+ print(socket.historical.snapshots.list("org_slug", query_params))
1523
+
1524
+ **PARAMETERS:**
1525
+
1526
+ - **org_slug (str)** - The organization slug
1527
+ - **query_params (dict, optional)** - Optional query parameters for filtering
@@ -22,6 +22,7 @@ Initializing the module
22
22
  - **token (str)** - The Socket API Key for your Organization
23
23
  - **timeout (int)** - The number of seconds to wait before failing the connection
24
24
  - **allow_unverified (bool)** - Whether to skip SSL certificate verification (default: False). Set to True for testing with self-signed certificates.
25
+ - **user_agent (str, optional)** - Custom User-Agent string to use in API requests. If not provided, defaults to "SocketSDKPython/{version}"
25
26
 
26
27
  Supported Functions
27
28
  -------------------
@@ -102,6 +103,35 @@ Export a Socket SBOM as an SPDX SBOM
102
103
 
103
104
  **PARAMETERS:**
104
105
 
106
+ - **org_slug (str)** - The organization name
107
+ - **id (str)** - The ID of either a full scan or an SBOM report
108
+ - **query_params (ExportQueryParams)** - Optional query parameters for filtering:
109
+ - **author (str)** - Filter by author
110
+ - **project_group (str)** - Filter by project group
111
+ - **project_name (str)** - Filter by project name
112
+ - **project_version (str)** - Filter by project version
113
+ - **project_id (str)** - Filter by project ID
114
+
115
+ export.openvex_bom(org_slug, id, query_params)
116
+ """"""""""""""""""""""""""""""""""""""""""""""
117
+ Export a Socket SBOM as an OpenVEX SBOM
118
+
119
+ **Usage:**
120
+
121
+ .. code-block:: python
122
+
123
+ from socketdev import socketdev
124
+ from socketdev.export import ExportQueryParams
125
+
126
+ socket = socketdev(token="REPLACE_ME")
127
+ query_params = ExportQueryParams(
128
+ project_name="my-project",
129
+ project_version="1.0.0"
130
+ )
131
+ print(socket.export.openvex_bom("org_slug", "sbom_id", query_params))
132
+
133
+ **PARAMETERS:**
134
+
105
135
  - **org_slug (str)** - The organization name
106
136
  - **id (str)** - The ID of either a full scan or an SBOM report
107
137
  - **query_params (ExportQueryParams)** - Optional query parameters for filtering:
@@ -305,6 +335,24 @@ Get GitHub Flavored Markdown diff between two full scans.
305
335
  - **before (str)** - The base full scan ID
306
336
  - **after (str)** - The comparison full scan ID
307
337
 
338
+ fullscans.finalize_tier1(full_scan_id, tier1_reachability_scan_id)
339
+ """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
340
+ Finalize a tier 1 reachability scan by associating it with a full scan.
341
+
342
+ **Usage:**
343
+
344
+ .. code-block:: python
345
+
346
+ from socketdev import socketdev
347
+ socket = socketdev(token="REPLACE_ME")
348
+ success = socket.fullscans.finalize_tier1("full_scan_id", "tier1_reachability_scan_id")
349
+ print(f"Finalization successful: {success}")
350
+
351
+ **PARAMETERS:**
352
+
353
+ - **full_scan_id (str)** - The ID of the full scan to associate with the tier 1 scan
354
+ - **tier1_reachability_scan_id (str)** - The tier 1 reachability scan ID from the facts file
355
+
308
356
  basics.get_config(org_slug, use_types)
309
357
  """"""""""""""""""""""""""""""""""""""
310
358
  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.
@@ -1157,3 +1205,272 @@ Retrieve the OpenAPI specification for the Socket API.
1157
1205
  **PARAMETERS:**
1158
1206
 
1159
1207
  None required.
1208
+
1209
+ webhooks.list(org_slug, \*\*query_params)
1210
+ """""""""""""""""""""""""""""""""""""""""""
1211
+ List all webhooks for an organization.
1212
+
1213
+ **Usage:**
1214
+
1215
+ .. code-block:: python
1216
+
1217
+ from socketdev import socketdev
1218
+ socket = socketdev(token="REPLACE_ME")
1219
+ print(socket.webhooks.list("org_slug"))
1220
+
1221
+ # With query parameters
1222
+ print(socket.webhooks.list("org_slug", limit=10, offset=0))
1223
+
1224
+ **PARAMETERS:**
1225
+
1226
+ - **org_slug (str)** - The organization slug
1227
+ - **query_params** - Optional query parameters for filtering
1228
+
1229
+ webhooks.create(org_slug, \*\*kwargs)
1230
+ """"""""""""""""""""""""""""""""""""""
1231
+ Create a new webhook for an organization.
1232
+
1233
+ **Usage:**
1234
+
1235
+ .. code-block:: python
1236
+
1237
+ from socketdev import socketdev
1238
+ socket = socketdev(token="REPLACE_ME")
1239
+ webhook_config = {
1240
+ "url": "https://example.com/webhook",
1241
+ "events": ["alert.created", "scan.completed"]
1242
+ }
1243
+ print(socket.webhooks.create("org_slug", **webhook_config))
1244
+
1245
+ **PARAMETERS:**
1246
+
1247
+ - **org_slug (str)** - The organization slug
1248
+ - **kwargs** - Webhook configuration parameters
1249
+
1250
+ webhooks.get(org_slug, webhook_id)
1251
+ """"""""""""""""""""""""""""""""""
1252
+ Get details for a specific webhook.
1253
+
1254
+ **Usage:**
1255
+
1256
+ .. code-block:: python
1257
+
1258
+ from socketdev import socketdev
1259
+ socket = socketdev(token="REPLACE_ME")
1260
+ print(socket.webhooks.get("org_slug", "webhook_id"))
1261
+
1262
+ **PARAMETERS:**
1263
+
1264
+ - **org_slug (str)** - The organization slug
1265
+ - **webhook_id (str)** - The webhook ID
1266
+
1267
+ webhooks.update(org_slug, webhook_id, \*\*kwargs)
1268
+ """""""""""""""""""""""""""""""""""""""""""""""""""
1269
+ Update an existing webhook.
1270
+
1271
+ **Usage:**
1272
+
1273
+ .. code-block:: python
1274
+
1275
+ from socketdev import socketdev
1276
+ socket = socketdev(token="REPLACE_ME")
1277
+ updates = {
1278
+ "url": "https://example.com/new-webhook",
1279
+ "events": ["alert.created"]
1280
+ }
1281
+ print(socket.webhooks.update("org_slug", "webhook_id", **updates))
1282
+
1283
+ **PARAMETERS:**
1284
+
1285
+ - **org_slug (str)** - The organization slug
1286
+ - **webhook_id (str)** - The webhook ID
1287
+ - **kwargs** - Webhook configuration parameters to update
1288
+
1289
+ webhooks.delete(org_slug, webhook_id)
1290
+ """""""""""""""""""""""""""""""""""""
1291
+ Delete a webhook.
1292
+
1293
+ **Usage:**
1294
+
1295
+ .. code-block:: python
1296
+
1297
+ from socketdev import socketdev
1298
+ socket = socketdev(token="REPLACE_ME")
1299
+ print(socket.webhooks.delete("org_slug", "webhook_id"))
1300
+
1301
+ **PARAMETERS:**
1302
+
1303
+ - **org_slug (str)** - The organization slug
1304
+ - **webhook_id (str)** - The webhook ID
1305
+
1306
+ telemetry.get_config(org_slug)
1307
+ """"""""""""""""""""""""""""""
1308
+ Get telemetry configuration for an organization.
1309
+
1310
+ **Usage:**
1311
+
1312
+ .. code-block:: python
1313
+
1314
+ from socketdev import socketdev
1315
+ socket = socketdev(token="REPLACE_ME")
1316
+ print(socket.telemetry.get_config("org_slug"))
1317
+
1318
+ **PARAMETERS:**
1319
+
1320
+ - **org_slug (str)** - The organization slug
1321
+
1322
+ telemetry.update_config(org_slug, \*\*kwargs)
1323
+ """"""""""""""""""""""""""""""""""""""""""""""
1324
+ Update telemetry configuration for an organization.
1325
+
1326
+ **Usage:**
1327
+
1328
+ .. code-block:: python
1329
+
1330
+ from socketdev import socketdev
1331
+ socket = socketdev(token="REPLACE_ME")
1332
+ config = {
1333
+ "enabled": True,
1334
+ "sampling_rate": 0.5
1335
+ }
1336
+ print(socket.telemetry.update_config("org_slug", **config))
1337
+
1338
+ **PARAMETERS:**
1339
+
1340
+ - **org_slug (str)** - The organization slug
1341
+ - **kwargs** - Configuration parameters to update
1342
+
1343
+ alerts.get(org_slug, \*\*query_params)
1344
+ """""""""""""""""""""""""""""""""""""""
1345
+ Get alerts for an organization.
1346
+
1347
+ **Usage:**
1348
+
1349
+ .. code-block:: python
1350
+
1351
+ from socketdev import socketdev
1352
+ socket = socketdev(token="REPLACE_ME")
1353
+ print(socket.alerts.get("org_slug"))
1354
+
1355
+ # With query parameters
1356
+ print(socket.alerts.get("org_slug", severity="high", limit=50))
1357
+
1358
+ **PARAMETERS:**
1359
+
1360
+ - **org_slug (str)** - The organization slug
1361
+ - **query_params** - Optional query parameters for filtering
1362
+
1363
+ fixes.get(org_slug, \*\*query_params)
1364
+ """"""""""""""""""""""""""""""""""""""
1365
+ Get available fixes for an organization.
1366
+
1367
+ **Usage:**
1368
+
1369
+ .. code-block:: python
1370
+
1371
+ from socketdev import socketdev
1372
+ socket = socketdev(token="REPLACE_ME")
1373
+ print(socket.fixes.get("org_slug"))
1374
+
1375
+ # With query parameters
1376
+ print(socket.fixes.get("org_slug", ecosystem="npm"))
1377
+
1378
+ **PARAMETERS:**
1379
+
1380
+ - **org_slug (str)** - The organization slug
1381
+ - **query_params** - Optional query parameters for filtering
1382
+
1383
+ supportedfiles.get(org_slug)
1384
+ """"""""""""""""""""""""""""
1385
+ Get list of supported manifest file types for an organization.
1386
+
1387
+ **Usage:**
1388
+
1389
+ .. code-block:: python
1390
+
1391
+ from socketdev import socketdev
1392
+ socket = socketdev(token="REPLACE_ME")
1393
+ print(socket.supportedfiles.get("org_slug"))
1394
+
1395
+ **PARAMETERS:**
1396
+
1397
+ - **org_slug (str)** - The organization slug
1398
+
1399
+ alertfullscansearch.search(org_slug, \*\*query_params)
1400
+ """""""""""""""""""""""""""""""""""""""""""""""""""""""
1401
+ Search alerts across full scans.
1402
+
1403
+ **Usage:**
1404
+
1405
+ .. code-block:: python
1406
+
1407
+ from socketdev import socketdev
1408
+ socket = socketdev(token="REPLACE_ME")
1409
+ search_params = {
1410
+ "query": "CVE-2024-1234",
1411
+ "limit": 20
1412
+ }
1413
+ print(socket.alertfullscansearch.search("org_slug", **search_params))
1414
+
1415
+ **PARAMETERS:**
1416
+
1417
+ - **org_slug (str)** - The organization slug
1418
+ - **query_params** - Optional query parameters for filtering
1419
+
1420
+ historical.dependencies_trend(org_slug, query_params)
1421
+ """"""""""""""""""""""""""""""""""""""""""""""""""""""
1422
+ Get historical dependency trends data for an organization.
1423
+
1424
+ **Usage:**
1425
+
1426
+ .. code-block:: python
1427
+
1428
+ from socketdev import socketdev
1429
+ socket = socketdev(token="REPLACE_ME")
1430
+ query_params = {
1431
+ "from": "2024-01-01",
1432
+ "to": "2024-12-31"
1433
+ }
1434
+ print(socket.historical.dependencies_trend("org_slug", query_params))
1435
+
1436
+ **PARAMETERS:**
1437
+
1438
+ - **org_slug (str)** - The organization slug
1439
+ - **query_params (dict, optional)** - Optional query parameters for date filtering
1440
+
1441
+ historical.snapshots.create(org_slug)
1442
+ """""""""""""""""""""""""""""""""""""
1443
+ Create a new snapshot for an organization.
1444
+
1445
+ **Usage:**
1446
+
1447
+ .. code-block:: python
1448
+
1449
+ from socketdev import socketdev
1450
+ socket = socketdev(token="REPLACE_ME")
1451
+ print(socket.historical.snapshots.create("org_slug"))
1452
+
1453
+ **PARAMETERS:**
1454
+
1455
+ - **org_slug (str)** - The organization slug
1456
+
1457
+ historical.snapshots.list(org_slug, query_params)
1458
+ """""""""""""""""""""""""""""""""""""""""""""""""
1459
+ List historical snapshots for an organization.
1460
+
1461
+ **Usage:**
1462
+
1463
+ .. code-block:: python
1464
+
1465
+ from socketdev import socketdev
1466
+ socket = socketdev(token="REPLACE_ME")
1467
+ print(socket.historical.snapshots.list("org_slug"))
1468
+
1469
+ # With query parameters
1470
+ query_params = {"limit": 10, "offset": 0}
1471
+ print(socket.historical.snapshots.list("org_slug", query_params))
1472
+
1473
+ **PARAMETERS:**
1474
+
1475
+ - **org_slug (str)** - The organization slug
1476
+ - **query_params (dict, optional)** - Optional query parameters for filtering
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "socketdev"
7
- version = "3.0.24"
7
+ version = "3.0.28"
8
8
  requires-python = ">= 3.9"
9
9
  dependencies = [
10
10
  'requests',
@@ -52,7 +52,7 @@ request_timeout = 1200
52
52
 
53
53
 
54
54
  class socketdev:
55
- def __init__(self, token: Optional[str] = None, timeout: int = 1200, allow_unverified: bool = False):
55
+ def __init__(self, token: Optional[str] = None, timeout: int = 1200, allow_unverified: bool = False, user_agent: Optional[str] = None):
56
56
  # Try to get token from environment variables if not provided
57
57
  if token is None:
58
58
  token = (
@@ -73,6 +73,8 @@ class socketdev:
73
73
  self.api.encode_key(self.token)
74
74
  self.api.set_timeout(timeout)
75
75
  self.api.set_allow_unverified(allow_unverified)
76
+ if user_agent is not None:
77
+ self.api.set_user_agent(user_agent)
76
78
 
77
79
  self.dependencies = Dependencies(self.api)
78
80
  self.export = Export(self.api)
@@ -26,6 +26,7 @@ class API:
26
26
  self.api_url = "https://api.socket.dev/v0"
27
27
  self.request_timeout = 30
28
28
  self.allow_unverified = False
29
+ self.user_agent = None
29
30
 
30
31
  def encode_key(self, token: str):
31
32
  self.encoded_key = base64.b64encode(token.encode()).decode("ascii")
@@ -36,6 +37,9 @@ class API:
36
37
  def set_allow_unverified(self, allow_unverified: bool):
37
38
  self.allow_unverified = allow_unverified
38
39
 
40
+ def set_user_agent(self, user_agent: str):
41
+ self.user_agent = user_agent
42
+
39
43
  def do_request(
40
44
  self,
41
45
  path: str,
@@ -48,9 +52,10 @@ class API:
48
52
  raise APIKeyMissing
49
53
 
50
54
  if headers is None:
55
+ user_agent_string = self.user_agent if self.user_agent is not None else f"SocketSDKPython/{__version__}"
51
56
  headers = {
52
57
  "Authorization": f"Basic {self.encoded_key}",
53
- "User-Agent": f"SocketSDKPython/{__version__}",
58
+ "User-Agent": user_agent_string,
54
59
  "accept": "application/json",
55
60
  }
56
61
  url = f"{self.api_url}/{path}"
@@ -789,6 +789,14 @@ class FullScans:
789
789
  org_slug = str(params.org_slug)
790
790
  params_dict = params.to_dict()
791
791
  params_dict.pop("org_slug")
792
+ # Remove pull_request param if it's None, 0, or not an integer
793
+ if hasattr(params, 'pull_request') and (
794
+ params.pull_request is None or
795
+ not isinstance(params.pull_request, int) or
796
+ params.pull_request == 0
797
+ ):
798
+ print("Removing pull_request param from FullScanParams as it is None, 0, or not an integer")
799
+ params_dict.pop("pull_request")
792
800
  params_arg = urllib.parse.urlencode(params_dict)
793
801
  path = "orgs/" + org_slug + "/full-scans?" + str(params_arg)
794
802
 
@@ -1070,4 +1078,4 @@ class FullScans:
1070
1078
 
1071
1079
  error_message = response.json().get("error", {}).get("message", "Unknown error") if response.text else "Unknown error"
1072
1080
  log.error(f"Error downloading tar files: {response.status_code}, message: {error_message}")
1073
- return b""
1081
+ return b""
@@ -0,0 +1 @@
1
+ __version__ = "3.0.28"
@@ -1 +0,0 @@
1
- __version__ = "3.0.24"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes