socketdev 3.0.25__py3-none-any.whl → 3.0.29__py3-none-any.whl

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.
@@ -41,6 +41,12 @@ class DiffType(str, Enum):
41
41
  UPDATED = "updated"
42
42
 
43
43
 
44
+ class ScanType(str, Enum):
45
+ SOCKET = "socket"
46
+ SOCKET_TIER1 = "socket_tier1"
47
+ SOCKET_BASICS = "socket_basics"
48
+
49
+
44
50
  @dataclass(kw_only=True)
45
51
  class SocketPURL:
46
52
  type: SocketPURL_Type
@@ -99,6 +105,7 @@ class FullScanParams:
99
105
  make_default_branch: Optional[bool] = None
100
106
  set_as_pending_head: Optional[bool] = None
101
107
  tmp: Optional[bool] = None
108
+ scan_type: Optional[ScanType] = None
102
109
 
103
110
  def __getitem__(self, key):
104
111
  return getattr(self, key)
@@ -109,6 +116,7 @@ class FullScanParams:
109
116
  @classmethod
110
117
  def from_dict(cls, data: dict) -> "FullScanParams":
111
118
  integration_type = data.get("integration_type")
119
+ scan_type = data.get("scan_type")
112
120
  return cls(
113
121
  repo=data["repo"],
114
122
  org_slug=data.get("org_slug"),
@@ -122,6 +130,7 @@ class FullScanParams:
122
130
  make_default_branch=data.get("make_default_branch"),
123
131
  set_as_pending_head=data.get("set_as_pending_head"),
124
132
  tmp=data.get("tmp"),
133
+ scan_type=ScanType(scan_type) if scan_type is not None else None,
125
134
  )
126
135
 
127
136
 
@@ -789,6 +798,14 @@ class FullScans:
789
798
  org_slug = str(params.org_slug)
790
799
  params_dict = params.to_dict()
791
800
  params_dict.pop("org_slug")
801
+ # Remove pull_request param if it's None, 0, or not an integer
802
+ if hasattr(params, 'pull_request') and (
803
+ params.pull_request is None or
804
+ not isinstance(params.pull_request, int) or
805
+ params.pull_request == 0
806
+ ):
807
+ print("Removing pull_request param from FullScanParams as it is None, 0, or not an integer")
808
+ params_dict.pop("pull_request")
792
809
  params_arg = urllib.parse.urlencode(params_dict)
793
810
  path = "orgs/" + org_slug + "/full-scans?" + str(params_arg)
794
811
 
@@ -1070,4 +1087,4 @@ class FullScans:
1070
1087
 
1071
1088
  error_message = response.json().get("error", {}).get("message", "Unknown error") if response.text else "Unknown error"
1072
1089
  log.error(f"Error downloading tar files: {response.status_code}, message: {error_message}")
1073
- return b""
1090
+ return b""
socketdev/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "3.0.25"
1
+ __version__ = "3.0.29"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: socketdev
3
- Version: 3.0.25
3
+ Version: 3.0.29
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:
@@ -248,6 +278,8 @@ Create a full scan from a set of package manifest files. Returns a full scan inc
248
278
  +------------------------+------------+-------------------------------------------------------------------------------+
249
279
  | integration_org_slug | False | Organization slug for integration |
250
280
  +------------------------+------------+-------------------------------------------------------------------------------+
281
+ | scan_type | False | ScanType enum value: "socket", "socket_tier1", or "socket_basics" |
282
+ +------------------------+------------+-------------------------------------------------------------------------------+
251
283
 
252
284
  fullscans.delete(org_slug, full_scan_id)
253
285
  """"""""""""""""""""""""""""""""""""""""
@@ -356,6 +388,24 @@ Get GitHub Flavored Markdown diff between two full scans.
356
388
  - **before (str)** - The base full scan ID
357
389
  - **after (str)** - The comparison full scan ID
358
390
 
391
+ fullscans.finalize_tier1(full_scan_id, tier1_reachability_scan_id)
392
+ """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
393
+ Finalize a tier 1 reachability scan by associating it with a full scan.
394
+
395
+ **Usage:**
396
+
397
+ .. code-block:: python
398
+
399
+ from socketdev import socketdev
400
+ socket = socketdev(token="REPLACE_ME")
401
+ success = socket.fullscans.finalize_tier1("full_scan_id", "tier1_reachability_scan_id")
402
+ print(f"Finalization successful: {success}")
403
+
404
+ **PARAMETERS:**
405
+
406
+ - **full_scan_id (str)** - The ID of the full scan to associate with the tier 1 scan
407
+ - **tier1_reachability_scan_id (str)** - The tier 1 reachability scan ID from the facts file
408
+
359
409
  basics.get_config(org_slug, use_types)
360
410
  """"""""""""""""""""""""""""""""""""""
361
411
  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 +1258,272 @@ Retrieve the OpenAPI specification for the Socket API.
1208
1258
  **PARAMETERS:**
1209
1259
 
1210
1260
  None required.
1261
+
1262
+ webhooks.list(org_slug, \*\*query_params)
1263
+ """""""""""""""""""""""""""""""""""""""""""
1264
+ List all webhooks for an organization.
1265
+
1266
+ **Usage:**
1267
+
1268
+ .. code-block:: python
1269
+
1270
+ from socketdev import socketdev
1271
+ socket = socketdev(token="REPLACE_ME")
1272
+ print(socket.webhooks.list("org_slug"))
1273
+
1274
+ # With query parameters
1275
+ print(socket.webhooks.list("org_slug", limit=10, offset=0))
1276
+
1277
+ **PARAMETERS:**
1278
+
1279
+ - **org_slug (str)** - The organization slug
1280
+ - **query_params** - Optional query parameters for filtering
1281
+
1282
+ webhooks.create(org_slug, \*\*kwargs)
1283
+ """"""""""""""""""""""""""""""""""""""
1284
+ Create a new webhook for an organization.
1285
+
1286
+ **Usage:**
1287
+
1288
+ .. code-block:: python
1289
+
1290
+ from socketdev import socketdev
1291
+ socket = socketdev(token="REPLACE_ME")
1292
+ webhook_config = {
1293
+ "url": "https://example.com/webhook",
1294
+ "events": ["alert.created", "scan.completed"]
1295
+ }
1296
+ print(socket.webhooks.create("org_slug", **webhook_config))
1297
+
1298
+ **PARAMETERS:**
1299
+
1300
+ - **org_slug (str)** - The organization slug
1301
+ - **kwargs** - Webhook configuration parameters
1302
+
1303
+ webhooks.get(org_slug, webhook_id)
1304
+ """"""""""""""""""""""""""""""""""
1305
+ Get details for a specific webhook.
1306
+
1307
+ **Usage:**
1308
+
1309
+ .. code-block:: python
1310
+
1311
+ from socketdev import socketdev
1312
+ socket = socketdev(token="REPLACE_ME")
1313
+ print(socket.webhooks.get("org_slug", "webhook_id"))
1314
+
1315
+ **PARAMETERS:**
1316
+
1317
+ - **org_slug (str)** - The organization slug
1318
+ - **webhook_id (str)** - The webhook ID
1319
+
1320
+ webhooks.update(org_slug, webhook_id, \*\*kwargs)
1321
+ """""""""""""""""""""""""""""""""""""""""""""""""""
1322
+ Update an existing webhook.
1323
+
1324
+ **Usage:**
1325
+
1326
+ .. code-block:: python
1327
+
1328
+ from socketdev import socketdev
1329
+ socket = socketdev(token="REPLACE_ME")
1330
+ updates = {
1331
+ "url": "https://example.com/new-webhook",
1332
+ "events": ["alert.created"]
1333
+ }
1334
+ print(socket.webhooks.update("org_slug", "webhook_id", **updates))
1335
+
1336
+ **PARAMETERS:**
1337
+
1338
+ - **org_slug (str)** - The organization slug
1339
+ - **webhook_id (str)** - The webhook ID
1340
+ - **kwargs** - Webhook configuration parameters to update
1341
+
1342
+ webhooks.delete(org_slug, webhook_id)
1343
+ """""""""""""""""""""""""""""""""""""
1344
+ Delete a webhook.
1345
+
1346
+ **Usage:**
1347
+
1348
+ .. code-block:: python
1349
+
1350
+ from socketdev import socketdev
1351
+ socket = socketdev(token="REPLACE_ME")
1352
+ print(socket.webhooks.delete("org_slug", "webhook_id"))
1353
+
1354
+ **PARAMETERS:**
1355
+
1356
+ - **org_slug (str)** - The organization slug
1357
+ - **webhook_id (str)** - The webhook ID
1358
+
1359
+ telemetry.get_config(org_slug)
1360
+ """"""""""""""""""""""""""""""
1361
+ Get telemetry configuration for an organization.
1362
+
1363
+ **Usage:**
1364
+
1365
+ .. code-block:: python
1366
+
1367
+ from socketdev import socketdev
1368
+ socket = socketdev(token="REPLACE_ME")
1369
+ print(socket.telemetry.get_config("org_slug"))
1370
+
1371
+ **PARAMETERS:**
1372
+
1373
+ - **org_slug (str)** - The organization slug
1374
+
1375
+ telemetry.update_config(org_slug, \*\*kwargs)
1376
+ """"""""""""""""""""""""""""""""""""""""""""""
1377
+ Update telemetry configuration for an organization.
1378
+
1379
+ **Usage:**
1380
+
1381
+ .. code-block:: python
1382
+
1383
+ from socketdev import socketdev
1384
+ socket = socketdev(token="REPLACE_ME")
1385
+ config = {
1386
+ "enabled": True,
1387
+ "sampling_rate": 0.5
1388
+ }
1389
+ print(socket.telemetry.update_config("org_slug", **config))
1390
+
1391
+ **PARAMETERS:**
1392
+
1393
+ - **org_slug (str)** - The organization slug
1394
+ - **kwargs** - Configuration parameters to update
1395
+
1396
+ alerts.get(org_slug, \*\*query_params)
1397
+ """""""""""""""""""""""""""""""""""""""
1398
+ Get alerts for an organization.
1399
+
1400
+ **Usage:**
1401
+
1402
+ .. code-block:: python
1403
+
1404
+ from socketdev import socketdev
1405
+ socket = socketdev(token="REPLACE_ME")
1406
+ print(socket.alerts.get("org_slug"))
1407
+
1408
+ # With query parameters
1409
+ print(socket.alerts.get("org_slug", severity="high", limit=50))
1410
+
1411
+ **PARAMETERS:**
1412
+
1413
+ - **org_slug (str)** - The organization slug
1414
+ - **query_params** - Optional query parameters for filtering
1415
+
1416
+ fixes.get(org_slug, \*\*query_params)
1417
+ """"""""""""""""""""""""""""""""""""""
1418
+ Get available fixes for an organization.
1419
+
1420
+ **Usage:**
1421
+
1422
+ .. code-block:: python
1423
+
1424
+ from socketdev import socketdev
1425
+ socket = socketdev(token="REPLACE_ME")
1426
+ print(socket.fixes.get("org_slug"))
1427
+
1428
+ # With query parameters
1429
+ print(socket.fixes.get("org_slug", ecosystem="npm"))
1430
+
1431
+ **PARAMETERS:**
1432
+
1433
+ - **org_slug (str)** - The organization slug
1434
+ - **query_params** - Optional query parameters for filtering
1435
+
1436
+ supportedfiles.get(org_slug)
1437
+ """"""""""""""""""""""""""""
1438
+ Get list of supported manifest file types for an organization.
1439
+
1440
+ **Usage:**
1441
+
1442
+ .. code-block:: python
1443
+
1444
+ from socketdev import socketdev
1445
+ socket = socketdev(token="REPLACE_ME")
1446
+ print(socket.supportedfiles.get("org_slug"))
1447
+
1448
+ **PARAMETERS:**
1449
+
1450
+ - **org_slug (str)** - The organization slug
1451
+
1452
+ alertfullscansearch.search(org_slug, \*\*query_params)
1453
+ """""""""""""""""""""""""""""""""""""""""""""""""""""""
1454
+ Search alerts across full scans.
1455
+
1456
+ **Usage:**
1457
+
1458
+ .. code-block:: python
1459
+
1460
+ from socketdev import socketdev
1461
+ socket = socketdev(token="REPLACE_ME")
1462
+ search_params = {
1463
+ "query": "CVE-2024-1234",
1464
+ "limit": 20
1465
+ }
1466
+ print(socket.alertfullscansearch.search("org_slug", **search_params))
1467
+
1468
+ **PARAMETERS:**
1469
+
1470
+ - **org_slug (str)** - The organization slug
1471
+ - **query_params** - Optional query parameters for filtering
1472
+
1473
+ historical.dependencies_trend(org_slug, query_params)
1474
+ """"""""""""""""""""""""""""""""""""""""""""""""""""""
1475
+ Get historical dependency trends data for an organization.
1476
+
1477
+ **Usage:**
1478
+
1479
+ .. code-block:: python
1480
+
1481
+ from socketdev import socketdev
1482
+ socket = socketdev(token="REPLACE_ME")
1483
+ query_params = {
1484
+ "from": "2024-01-01",
1485
+ "to": "2024-12-31"
1486
+ }
1487
+ print(socket.historical.dependencies_trend("org_slug", query_params))
1488
+
1489
+ **PARAMETERS:**
1490
+
1491
+ - **org_slug (str)** - The organization slug
1492
+ - **query_params (dict, optional)** - Optional query parameters for date filtering
1493
+
1494
+ historical.snapshots.create(org_slug)
1495
+ """""""""""""""""""""""""""""""""""""
1496
+ Create a new snapshot for an organization.
1497
+
1498
+ **Usage:**
1499
+
1500
+ .. code-block:: python
1501
+
1502
+ from socketdev import socketdev
1503
+ socket = socketdev(token="REPLACE_ME")
1504
+ print(socket.historical.snapshots.create("org_slug"))
1505
+
1506
+ **PARAMETERS:**
1507
+
1508
+ - **org_slug (str)** - The organization slug
1509
+
1510
+ historical.snapshots.list(org_slug, query_params)
1511
+ """""""""""""""""""""""""""""""""""""""""""""""""
1512
+ List historical snapshots for an organization.
1513
+
1514
+ **Usage:**
1515
+
1516
+ .. code-block:: python
1517
+
1518
+ from socketdev import socketdev
1519
+ socket = socketdev(token="REPLACE_ME")
1520
+ print(socket.historical.snapshots.list("org_slug"))
1521
+
1522
+ # With query parameters
1523
+ query_params = {"limit": 10, "offset": 0}
1524
+ print(socket.historical.snapshots.list("org_slug", query_params))
1525
+
1526
+ **PARAMETERS:**
1527
+
1528
+ - **org_slug (str)** - The organization slug
1529
+ - **query_params (dict, optional)** - Optional query parameters for filtering
@@ -1,7 +1,7 @@
1
1
  socketdev/__init__.py,sha256=mYuLIlXdU0uec1418LIw_oILBRh5DyWQDpWafaMa_AU,4484
2
2
  socketdev/exceptions.py,sha256=SNU1EgswGwnxI_Zmm325ruP6CFg5C4MsS1qxXWwBJqs,1120
3
3
  socketdev/log.py,sha256=AgEcsPN3y9U-fze8pTFvLigVvNob2vmNC-TkOOQkkeQ,90
4
- socketdev/version.py,sha256=MMVprXHVt6ISLQw_xJGSq2LUkN77n9L5I5MyPittz60,23
4
+ socketdev/version.py,sha256=97AxRrRQ28q1jf_8nYGd7l5F8X3tv0nwQthsndxQ5PI,23
5
5
  socketdev/alertfullscansearch/__init__.py,sha256=YwXrgnrI9z9rAexXFFmoXQcaQdGW47HRhQ58CQBCG3U,884
6
6
  socketdev/alerts/__init__.py,sha256=kGLCNXtXTRz3vl2s_bPQ7xuds_QGwNQnah1TfHzp2MU,846
7
7
  socketdev/alerttypes/__init__.py,sha256=W-m2D9VxbepSAUELJPmWmX40zksGZbQcSzwQ1kjlB1k,1169
@@ -17,7 +17,7 @@ socketdev/dependencies/__init__.py,sha256=zdAb0lMYF8tTHFWa9kGwz5dv4_Sp1UpzQseg_4
17
17
  socketdev/diffscans/__init__.py,sha256=ndsgyFmsvK29pJAEhZyBByZ9ampf1Ks6oV8y1q7mssw,5294
18
18
  socketdev/export/__init__.py,sha256=5DqVqHnaK5Aq-ueSTIAplOZJpF21W_pXysIzmMNLGPg,3667
19
19
  socketdev/fixes/__init__.py,sha256=ouRSQ5FcqQcjAmrU8aAgd0ZJeo431wBOEVKLR36etik,856
20
- socketdev/fullscans/__init__.py,sha256=QaxFUfpQLdVqLiL5mxCnU-t-ZwLvTrUwSEY69ihEn-g,36399
20
+ socketdev/fullscans/__init__.py,sha256=X4JJS7eUQGDSC6wYH7zkNWgKcehxXeR2PQ946FfQjss,37100
21
21
  socketdev/historical/__init__.py,sha256=DXFmRrHLWHKbZrB8eermM4YG6j4C1S4Lz6-V63_p2gs,3472
22
22
  socketdev/labels/__init__.py,sha256=Ep19ZraKqi_a-3-eAOWGhPNQsgwGRY9N28Oyxlxrz-g,5128
23
23
  socketdev/licensemetadata/__init__.py,sha256=pDcvpkc08QtMqhsnKP1Cfjvs3m-MRPYUK-uLh8aRkrU,815
@@ -39,7 +39,7 @@ socketdev/triage/__init__.py,sha256=-h599vThVetfRSOAs1e4IUoMjcXS8xOsUfub41XPiX4,
39
39
  socketdev/uploadmanifests/__init__.py,sha256=-sFHbOW-aw7U0wRfEJT_Edrzx8aCbzD9cTGmVTNJKpw,6043
40
40
  socketdev/utils/__init__.py,sha256=E11UJTsWsN-ZurOwtKvPGOTc9UMP3ND79nPbmNRRQ6E,17666
41
41
  socketdev/webhooks/__init__.py,sha256=fme6K7ma_Gvk_TFOLz9jVcR5QJbDpMHXqRaU3x_RShY,3507
42
- socketdev-3.0.25.dist-info/METADATA,sha256=eFTw6GtiGzpA9l_lDqfCHoIxAuTpPJXbXiPaMeogBns,36240
43
- socketdev-3.0.25.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
44
- socketdev-3.0.25.dist-info/licenses/LICENSE,sha256=mC0II_UuE-_gCG9XqOLNyrV3crnROzMpdAetGnMrhpw,1068
45
- socketdev-3.0.25.dist-info/RECORD,,
42
+ socketdev-3.0.29.dist-info/METADATA,sha256=FK3Sj5sab6C_z-fP0i_aIMZdRs96qGdMyEG7jY9EtJY,44917
43
+ socketdev-3.0.29.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
44
+ socketdev-3.0.29.dist-info/licenses/LICENSE,sha256=mC0II_UuE-_gCG9XqOLNyrV3crnROzMpdAetGnMrhpw,1068
45
+ socketdev-3.0.29.dist-info/RECORD,,