socketdev 3.0.0__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.
- socketdev/__init__.py +69 -0
- socketdev/apitokens/__init__.py +0 -0
- socketdev/auditlog/__init__.py +0 -0
- socketdev/core/api.py +144 -0
- socketdev/core/classes.py +148 -0
- socketdev/core/dedupe.py +105 -0
- socketdev/core/issues.py +2101 -0
- socketdev/dependencies/__init__.py +48 -0
- socketdev/diffscans/__init__.py +105 -0
- socketdev/exceptions.py +47 -0
- socketdev/export/__init__.py +75 -0
- socketdev/fullscans/__init__.py +888 -0
- socketdev/historical/__init__.py +84 -0
- socketdev/labels/__init__.py +121 -0
- socketdev/licensemetadata/__init__.py +27 -0
- socketdev/log.py +4 -0
- socketdev/npm/__init__.py +28 -0
- socketdev/openapi/__init__.py +19 -0
- socketdev/org/__init__.py +34 -0
- socketdev/purl/__init__.py +41 -0
- socketdev/quota/__init__.py +19 -0
- socketdev/report/__init__.py +72 -0
- socketdev/repos/__init__.py +165 -0
- socketdev/repositories/__init__.py +31 -0
- socketdev/sbom/__init__.py +62 -0
- socketdev/settings/__init__.py +172 -0
- socketdev/threatfeed/__init__.py +0 -0
- socketdev/tools/__init__.py +65 -0
- socketdev/triage/__init__.py +47 -0
- socketdev/utils/__init__.py +284 -0
- socketdev/version.py +1 -0
- socketdev-3.0.0.dist-info/METADATA +830 -0
- socketdev-3.0.0.dist-info/RECORD +35 -0
- socketdev-3.0.0.dist-info/WHEEL +4 -0
- socketdev-3.0.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,830 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: socketdev
|
|
3
|
+
Version: 3.0.0
|
|
4
|
+
Summary: Socket Security Python SDK
|
|
5
|
+
Project-URL: Homepage, https://github.com/socketdev/socketdev
|
|
6
|
+
Author-email: Douglas Coburn <douglas@socket.dev>
|
|
7
|
+
Maintainer-email: Douglas Coburn <douglas@socket.dev>
|
|
8
|
+
License: MIT License
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2025 Socket Inc.
|
|
11
|
+
|
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
in the Software without restriction, including without limitation the rights
|
|
15
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
furnished to do so, subject to the following conditions:
|
|
18
|
+
|
|
19
|
+
The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
copies or substantial portions of the Software.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
SOFTWARE.
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Keywords: oss,sca,sdk,security,socket.dev,socketsecurity
|
|
31
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
32
|
+
Classifier: Intended Audience :: Developers
|
|
33
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
34
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
35
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
39
|
+
Requires-Python: >=3.9
|
|
40
|
+
Requires-Dist: requests
|
|
41
|
+
Requires-Dist: typing-extensions>=4.12.2
|
|
42
|
+
Provides-Extra: dev
|
|
43
|
+
Requires-Dist: hatch>=1.14.0; extra == 'dev'
|
|
44
|
+
Requires-Dist: hatchling>=1.27.0; extra == 'dev'
|
|
45
|
+
Requires-Dist: ruff>=0.3.0; extra == 'dev'
|
|
46
|
+
Requires-Dist: twine>=4.0.0; extra == 'dev'
|
|
47
|
+
Provides-Extra: test
|
|
48
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'test'
|
|
49
|
+
Requires-Dist: pytest>=7.0.0; extra == 'test'
|
|
50
|
+
Description-Content-Type: text/x-rst
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
socketdev
|
|
54
|
+
#########
|
|
55
|
+
|
|
56
|
+
Purpose
|
|
57
|
+
-------
|
|
58
|
+
|
|
59
|
+
The Socket.dev Python SDK provides a wrapper around the Socket.dev REST API to simplify making calls to the API from Python.
|
|
60
|
+
|
|
61
|
+
Socket API v0 - https://docs.socket.dev/reference/introduction-to-socket-api
|
|
62
|
+
|
|
63
|
+
Initializing the module
|
|
64
|
+
-----------------------
|
|
65
|
+
|
|
66
|
+
.. code-block:: python
|
|
67
|
+
|
|
68
|
+
from socketdev import socketdev
|
|
69
|
+
socket = socketdev(token="REPLACE_ME", timeout=30)
|
|
70
|
+
|
|
71
|
+
**PARAMETERS:**
|
|
72
|
+
|
|
73
|
+
- **token (str)** - The Socket API Key for your Organization
|
|
74
|
+
- **Timeout (int)** - The number of seconds to wait before failing the connection
|
|
75
|
+
|
|
76
|
+
Supported Functions
|
|
77
|
+
-------------------
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
purl.post(license, components)
|
|
81
|
+
""""""""""""""""""""""""""""""
|
|
82
|
+
Retrieve the package information for a purl post
|
|
83
|
+
|
|
84
|
+
**Usage:**
|
|
85
|
+
|
|
86
|
+
.. code-block:: python
|
|
87
|
+
|
|
88
|
+
from socketdev import socketdev
|
|
89
|
+
socket = socketdev(token="REPLACE_ME")
|
|
90
|
+
license = "true"
|
|
91
|
+
components = [
|
|
92
|
+
{
|
|
93
|
+
"purl": "pkg:pypi/pyonepassword@5.0.0"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"purl": "pkg:pypi/socketsecurity"
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
print(socket.purl.post(license, components))
|
|
100
|
+
|
|
101
|
+
**PARAMETERS:**
|
|
102
|
+
|
|
103
|
+
- **license (str)** - The license parameter if enabled will show alerts and license information. If disabled will only show the basic package metadata and scores. Default is true
|
|
104
|
+
- **components (array{dict})** - The components list of packages urls
|
|
105
|
+
|
|
106
|
+
export.cdx_bom(org_slug, id, query_params)
|
|
107
|
+
""""""""""""""""""""""""""""""""""""""""""
|
|
108
|
+
Export a Socket SBOM as a CycloneDX SBOM
|
|
109
|
+
|
|
110
|
+
**Usage:**
|
|
111
|
+
|
|
112
|
+
.. code-block:: python
|
|
113
|
+
|
|
114
|
+
from socketdev import socketdev
|
|
115
|
+
from socketdev.export import ExportQueryParams
|
|
116
|
+
|
|
117
|
+
socket = socketdev(token="REPLACE_ME")
|
|
118
|
+
query_params = ExportQueryParams(
|
|
119
|
+
author="john_doe",
|
|
120
|
+
project_name="my-project"
|
|
121
|
+
)
|
|
122
|
+
print(socket.export.cdx_bom("org_slug", "sbom_id", query_params))
|
|
123
|
+
|
|
124
|
+
**PARAMETERS:**
|
|
125
|
+
|
|
126
|
+
- **org_slug (str)** - The organization name
|
|
127
|
+
- **id (str)** - The ID of either a full scan or an SBOM report
|
|
128
|
+
- **query_params (ExportQueryParams)** - Optional query parameters for filtering:
|
|
129
|
+
- **author (str)** - Filter by author
|
|
130
|
+
- **project_group (str)** - Filter by project group
|
|
131
|
+
- **project_name (str)** - Filter by project name
|
|
132
|
+
- **project_version (str)** - Filter by project version
|
|
133
|
+
- **project_id (str)** - Filter by project ID
|
|
134
|
+
|
|
135
|
+
export.spdx_bom(org_slug, id, query_params)
|
|
136
|
+
"""""""""""""""""""""""""""""""""""""""""""
|
|
137
|
+
Export a Socket SBOM as an SPDX SBOM
|
|
138
|
+
|
|
139
|
+
**Usage:**
|
|
140
|
+
|
|
141
|
+
.. code-block:: python
|
|
142
|
+
|
|
143
|
+
from socketdev import socketdev
|
|
144
|
+
from socketdev.export import ExportQueryParams
|
|
145
|
+
|
|
146
|
+
socket = socketdev(token="REPLACE_ME")
|
|
147
|
+
query_params = ExportQueryParams(
|
|
148
|
+
project_name="my-project",
|
|
149
|
+
project_version="1.0.0"
|
|
150
|
+
)
|
|
151
|
+
print(socket.export.spdx_bom("org_slug", "sbom_id", query_params))
|
|
152
|
+
|
|
153
|
+
**PARAMETERS:**
|
|
154
|
+
|
|
155
|
+
- **org_slug (str)** - The organization name
|
|
156
|
+
- **id (str)** - The ID of either a full scan or an SBOM report
|
|
157
|
+
- **query_params (ExportQueryParams)** - Optional query parameters for filtering:
|
|
158
|
+
- **author (str)** - Filter by author
|
|
159
|
+
- **project_group (str)** - Filter by project group
|
|
160
|
+
- **project_name (str)** - Filter by project name
|
|
161
|
+
- **project_version (str)** - Filter by project version
|
|
162
|
+
- **project_id (str)** - Filter by project ID
|
|
163
|
+
|
|
164
|
+
fullscans.get(org_slug)
|
|
165
|
+
"""""""""""""""""""""""
|
|
166
|
+
Retrieve the Fullscans information for around Organization
|
|
167
|
+
|
|
168
|
+
**Usage:**
|
|
169
|
+
|
|
170
|
+
.. code-block:: python
|
|
171
|
+
|
|
172
|
+
from socketdev import socketdev
|
|
173
|
+
socket = socketdev(token="REPLACE_ME")
|
|
174
|
+
print(socket.fullscans.get("org_slug"))
|
|
175
|
+
|
|
176
|
+
**PARAMETERS:**
|
|
177
|
+
|
|
178
|
+
- **org_slug (str)** - The organization name
|
|
179
|
+
|
|
180
|
+
fullscans.post(files, params)
|
|
181
|
+
"""""""""""""""""""""""""""""
|
|
182
|
+
Create a full scan from a set of package manifest files. Returns a full scan including all SBOM artifacts.
|
|
183
|
+
|
|
184
|
+
**Usage:**
|
|
185
|
+
|
|
186
|
+
.. code-block:: python
|
|
187
|
+
|
|
188
|
+
from socketdev import socketdev
|
|
189
|
+
socket = socketdev(token="REPLACE_ME")
|
|
190
|
+
files = [
|
|
191
|
+
"/path/to/manifest/package.json"
|
|
192
|
+
]
|
|
193
|
+
params = {
|
|
194
|
+
"org_slug": "org_name",
|
|
195
|
+
"repo": "TestRepo",
|
|
196
|
+
"branch": "main",
|
|
197
|
+
"commit_message": "Test Commit Message",
|
|
198
|
+
"commit_hash": "",
|
|
199
|
+
"pull_request": "",
|
|
200
|
+
"committers": "commiter",
|
|
201
|
+
"make_default_branch": False,
|
|
202
|
+
"set_as_pending_head": False,
|
|
203
|
+
"tmp": ""
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
print(socket.fullscans.post(files, params))
|
|
207
|
+
|
|
208
|
+
**PARAMETERS:**
|
|
209
|
+
|
|
210
|
+
- **files (list)** - List of file paths of manifest files
|
|
211
|
+
- **params (dict)** - List of parameters to create a fullscan
|
|
212
|
+
|
|
213
|
+
+------------------------+------------+-------------------------------------------------------------------------------+
|
|
214
|
+
| Parameter | Required | Description |
|
|
215
|
+
+========================+============+===============================================================================+
|
|
216
|
+
| org_slug | True | The string name in a git approved name for organization. |
|
|
217
|
+
+------------------------+------------+-------------------------------------------------------------------------------+
|
|
218
|
+
| repo | True | The string name in a git approved name for repositories. |
|
|
219
|
+
+------------------------+------------+-------------------------------------------------------------------------------+
|
|
220
|
+
| branch | False | The string name in a git approved name for branches. |
|
|
221
|
+
+------------------------+------------+-------------------------------------------------------------------------------+
|
|
222
|
+
| committers | False | The string name of the person doing the commit or running the CLI. |
|
|
223
|
+
| | | Can be specified multiple times to have more than one committer. |
|
|
224
|
+
+------------------------+------------+-------------------------------------------------------------------------------+
|
|
225
|
+
| pull_request | False | The integer for the PR or MR number. |
|
|
226
|
+
+------------------------+------------+-------------------------------------------------------------------------------+
|
|
227
|
+
| commit_message | False | The string for a commit message if there is one. |
|
|
228
|
+
+------------------------+------------+-------------------------------------------------------------------------------+
|
|
229
|
+
| make_default_branch | False | If the flag is specified this will signal that this is the default branch. |
|
|
230
|
+
+------------------------+------------+-------------------------------------------------------------------------------+
|
|
231
|
+
| commit_hash | False | Optional git commit hash |
|
|
232
|
+
+------------------------+------------+-------------------------------------------------------------------------------+
|
|
233
|
+
| set_as_pending_head | False | |
|
|
234
|
+
+------------------------+------------+-------------------------------------------------------------------------------+
|
|
235
|
+
| tmp | False | |
|
|
236
|
+
+------------------------+------------+-------------------------------------------------------------------------------+
|
|
237
|
+
|
|
238
|
+
fullscans.delete(org_slug, full_scan_id)
|
|
239
|
+
""""""""""""""""""""""""""""""""""""""""
|
|
240
|
+
Delete an existing full scan.
|
|
241
|
+
|
|
242
|
+
**Usage:**
|
|
243
|
+
|
|
244
|
+
.. code-block:: python
|
|
245
|
+
|
|
246
|
+
from socketdev import socketdev
|
|
247
|
+
socket = socketdev(token="REPLACE_ME")
|
|
248
|
+
print(socket.fullscans.delete(org_slug, full_scan_id))
|
|
249
|
+
|
|
250
|
+
**PARAMETERS:**
|
|
251
|
+
|
|
252
|
+
- **org_slug (str)** - The organization name
|
|
253
|
+
- **full_scan_id (str)** - The ID of the full scan
|
|
254
|
+
|
|
255
|
+
fullscans.stream_diff(org_slug, before, after, preview, include_license_details)
|
|
256
|
+
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
257
|
+
Stream a diff between two full scans. Returns a scan diff.
|
|
258
|
+
|
|
259
|
+
**Usage:**
|
|
260
|
+
|
|
261
|
+
.. code-block:: python
|
|
262
|
+
|
|
263
|
+
from socketdev import socketdev
|
|
264
|
+
socket = socketdev(token="REPLACE_ME")
|
|
265
|
+
print(socket.fullscans.stream_diff("org_slug", "before_scan_id", "after_scan_id"))
|
|
266
|
+
|
|
267
|
+
**PARAMETERS:**
|
|
268
|
+
|
|
269
|
+
- **org_slug (str)** - The organization name
|
|
270
|
+
- **before (str)** - The base full scan ID
|
|
271
|
+
- **after (str)** - The comparison full scan ID
|
|
272
|
+
- **include_license_details (bool)** - Include license details. Can greatly increase response size. Defaults to False.
|
|
273
|
+
|
|
274
|
+
fullscans.stream(org_slug, full_scan_id)
|
|
275
|
+
""""""""""""""""""""""""""""""""""""""""
|
|
276
|
+
Stream all SBOM artifacts for a full scan.
|
|
277
|
+
|
|
278
|
+
**Usage:**
|
|
279
|
+
|
|
280
|
+
.. code-block:: python
|
|
281
|
+
|
|
282
|
+
from socketdev import socketdev
|
|
283
|
+
socket = socketdev(token="REPLACE_ME")
|
|
284
|
+
print(socket.fullscans.stream(org_slug, full_scan_id))
|
|
285
|
+
|
|
286
|
+
**PARAMETERS:**
|
|
287
|
+
|
|
288
|
+
- **org_slug (str)** - The organization name
|
|
289
|
+
- **full_scan_id (str)** - The ID of the full scan
|
|
290
|
+
|
|
291
|
+
fullscans.metadata(org_slug, full_scan_id)
|
|
292
|
+
""""""""""""""""""""""""""""""""""""""""""
|
|
293
|
+
Get metadata for a single full scan
|
|
294
|
+
|
|
295
|
+
**Usage:**
|
|
296
|
+
|
|
297
|
+
.. code-block:: python
|
|
298
|
+
|
|
299
|
+
from socketdev import socketdev
|
|
300
|
+
socket = socketdev(token="REPLACE_ME")
|
|
301
|
+
print(socket.fullscans.metadata(org_slug, full_scan_id))
|
|
302
|
+
|
|
303
|
+
**PARAMETERS:**
|
|
304
|
+
|
|
305
|
+
- **org_slug (str)** - The organization name
|
|
306
|
+
- **full_scan_id (str)** - The ID of the full scan
|
|
307
|
+
|
|
308
|
+
dependencies.get(limit, offset)
|
|
309
|
+
"""""""""""""""""""""""""""""""
|
|
310
|
+
Retrieve the dependencies for the organization associated with the API Key
|
|
311
|
+
|
|
312
|
+
**Usage:**
|
|
313
|
+
|
|
314
|
+
.. code-block:: python
|
|
315
|
+
|
|
316
|
+
from socketdev import socketdev
|
|
317
|
+
socket = socketdev(token="REPLACE_ME")
|
|
318
|
+
print(socket.dependencies.get(10, 0))
|
|
319
|
+
|
|
320
|
+
**PARAMETERS:**
|
|
321
|
+
|
|
322
|
+
- **limit (int)** - The maximum number of dependencies to return
|
|
323
|
+
- **offset (int)** - The index to start from for pulling the dependencies
|
|
324
|
+
|
|
325
|
+
dependencies.post(files, params)
|
|
326
|
+
""""""""""""""""""""""""""""""""
|
|
327
|
+
Retrieve the dependencies for the organization associated with the API Key
|
|
328
|
+
|
|
329
|
+
**Usage:**
|
|
330
|
+
|
|
331
|
+
.. code-block:: python
|
|
332
|
+
|
|
333
|
+
from socketdev import socketdev
|
|
334
|
+
socket = socketdev(token="REPLACE_ME")
|
|
335
|
+
file_names = [
|
|
336
|
+
"path/to/package.json"
|
|
337
|
+
]
|
|
338
|
+
params = {
|
|
339
|
+
"repository": "username/repo-name",
|
|
340
|
+
"branch": "dependency-branch
|
|
341
|
+
}
|
|
342
|
+
print(socket.dependencies.post(file_names, params))
|
|
343
|
+
|
|
344
|
+
**PARAMETERS:**
|
|
345
|
+
|
|
346
|
+
- **files (list)** - The file paths of the manifest files to import into the Dependency API.
|
|
347
|
+
- **params (dict)** - A dictionary of the `repository` and `branch` options for the API
|
|
348
|
+
|
|
349
|
+
repos.get()
|
|
350
|
+
"""""""""""
|
|
351
|
+
Get a list of information about the tracked repositores
|
|
352
|
+
|
|
353
|
+
**Usage:**
|
|
354
|
+
|
|
355
|
+
.. code-block:: python
|
|
356
|
+
|
|
357
|
+
from socketdev import socketdev
|
|
358
|
+
socket = socketdev(token="REPLACE_ME")
|
|
359
|
+
print(socket.repos.get(sort="name", direction="asc", per_page=100, page=1))
|
|
360
|
+
|
|
361
|
+
**PARAMETERS:**
|
|
362
|
+
|
|
363
|
+
- **sort** - The key to sort on froom the repo properties. Defaults to `created_at`
|
|
364
|
+
- **direction** - Can be `desc` or `asc`. Defaults to `desc`
|
|
365
|
+
- **per_page** - Integer between 1 to 100. Defaults to `10`
|
|
366
|
+
- **page** - Integer page number defaults to `1`. If there are no more results it will be `0`
|
|
367
|
+
|
|
368
|
+
repos.post()
|
|
369
|
+
""""""""""""
|
|
370
|
+
Create a new Socket Repository
|
|
371
|
+
|
|
372
|
+
**Usage:**
|
|
373
|
+
|
|
374
|
+
.. code-block:: python
|
|
375
|
+
|
|
376
|
+
from socketdev import socketdev
|
|
377
|
+
socket = socketdev(token="REPLACE_ME")
|
|
378
|
+
print(
|
|
379
|
+
socket.repos.post(
|
|
380
|
+
name="example",
|
|
381
|
+
description="Info about Repo",
|
|
382
|
+
homepage="http://homepage",
|
|
383
|
+
visibility='public',
|
|
384
|
+
archived=False,
|
|
385
|
+
default_branch='not-main'
|
|
386
|
+
)
|
|
387
|
+
)
|
|
388
|
+
|
|
389
|
+
**PARAMETERS:**
|
|
390
|
+
|
|
391
|
+
- **name(required)** - The name of the Socket Repository
|
|
392
|
+
- **description(optional)** - String description of the repository
|
|
393
|
+
- **homepage(optional)** - URL of the homepage of the
|
|
394
|
+
- **visibility(optional)** - Can be `public` or `private` and defaults to `private`
|
|
395
|
+
- **archived(optional)** - Boolean on if the repository is archived. Defaults to `False`
|
|
396
|
+
- **default_branch(optional)** - String name of the default branch for the repository. Defaults to `main`
|
|
397
|
+
|
|
398
|
+
repos.repo()
|
|
399
|
+
""""""""""""
|
|
400
|
+
Get a list of information about the tracked repositores
|
|
401
|
+
|
|
402
|
+
**Usage:**
|
|
403
|
+
|
|
404
|
+
.. code-block:: python
|
|
405
|
+
|
|
406
|
+
from socketdev import socketdev
|
|
407
|
+
socket = socketdev(token="REPLACE_ME")
|
|
408
|
+
print(socket.repos.repo(org_slug="example", repo_name="example-repo")
|
|
409
|
+
|
|
410
|
+
repos.update()
|
|
411
|
+
""""""""""""""
|
|
412
|
+
Update an existing Socket Repository
|
|
413
|
+
|
|
414
|
+
**Usage:**
|
|
415
|
+
|
|
416
|
+
.. code-block:: python
|
|
417
|
+
|
|
418
|
+
from socketdev import socketdev
|
|
419
|
+
socket = socketdev(token="REPLACE_ME")
|
|
420
|
+
print(
|
|
421
|
+
socket.repos.update(
|
|
422
|
+
org_slug="example-org",
|
|
423
|
+
repo_name="example",
|
|
424
|
+
name="new-name-example",
|
|
425
|
+
description="Info about Repo",
|
|
426
|
+
homepage="http://homepage",
|
|
427
|
+
visibility='public',
|
|
428
|
+
archived=False,
|
|
429
|
+
default_branch='not-main'
|
|
430
|
+
)
|
|
431
|
+
)
|
|
432
|
+
|
|
433
|
+
- **name(optional)** - The name of the Socket Repository
|
|
434
|
+
- **description(optional)** - String description of the repository
|
|
435
|
+
- **homepage(optional)** - URL of the homepage of the
|
|
436
|
+
- **visibility(optional)** - Can be `public` or `private` and defaults to `private`
|
|
437
|
+
- **archived(optional)** - Boolean on if the repository is archived. Defaults to `False`
|
|
438
|
+
- **default_branch(optional)** - String name of the default branch for the repository. Defaults to `main`
|
|
439
|
+
|
|
440
|
+
repos.delete()
|
|
441
|
+
""""""""""""""
|
|
442
|
+
Delete a Socket Repository
|
|
443
|
+
|
|
444
|
+
**Usage:**
|
|
445
|
+
|
|
446
|
+
.. code-block:: python
|
|
447
|
+
|
|
448
|
+
from socketdev import socketdev
|
|
449
|
+
socket = socketdev(token="REPLACE_ME")
|
|
450
|
+
print(socket.repos.delete(org_slug="example", repo_name="example-repo")
|
|
451
|
+
|
|
452
|
+
**PARAMETERS:**
|
|
453
|
+
|
|
454
|
+
- **org_slug** - Name of the Socket Org
|
|
455
|
+
- **repo_name** - The name of the Socket Repository to delete
|
|
456
|
+
|
|
457
|
+
org.get()
|
|
458
|
+
"""""""""
|
|
459
|
+
Retrieve the Socket.dev org information
|
|
460
|
+
|
|
461
|
+
**Usage:**
|
|
462
|
+
|
|
463
|
+
.. code-block:: python
|
|
464
|
+
|
|
465
|
+
from socketdev import socketdev
|
|
466
|
+
socket = socketdev(token="REPLACE_ME")
|
|
467
|
+
print(socket.org.get())
|
|
468
|
+
|
|
469
|
+
quota.get()
|
|
470
|
+
"""""""""""
|
|
471
|
+
Retrieve the the current quota available for your API Key
|
|
472
|
+
|
|
473
|
+
**Usage:**
|
|
474
|
+
|
|
475
|
+
.. code-block:: python
|
|
476
|
+
|
|
477
|
+
from socketdev import socketdev
|
|
478
|
+
socket = socketdev(token="REPLACE_ME")
|
|
479
|
+
print(socket.quota.get())
|
|
480
|
+
|
|
481
|
+
settings.get()
|
|
482
|
+
""""""""""""""
|
|
483
|
+
Retrieve the Socket Organization Settings
|
|
484
|
+
|
|
485
|
+
**Usage:**
|
|
486
|
+
|
|
487
|
+
.. code-block:: python
|
|
488
|
+
|
|
489
|
+
from socketdev import socketdev
|
|
490
|
+
socket = socketdev(token="REPLACE_ME")
|
|
491
|
+
print(socket.settings.get())
|
|
492
|
+
|
|
493
|
+
report.supported()
|
|
494
|
+
""""""""""""""""""
|
|
495
|
+
Retrieve the supported types of manifest files for creating a report
|
|
496
|
+
|
|
497
|
+
**Usage:**
|
|
498
|
+
|
|
499
|
+
.. code-block:: python
|
|
500
|
+
|
|
501
|
+
from socketdev import socketdev
|
|
502
|
+
socket = socketdev(token="REPLACE_ME")
|
|
503
|
+
print(socket.report.supported())
|
|
504
|
+
|
|
505
|
+
Deprecated: report.list()
|
|
506
|
+
"""""""""""""""""""""""""
|
|
507
|
+
Retrieve the list of all reports for the organization
|
|
508
|
+
|
|
509
|
+
**Usage:**
|
|
510
|
+
|
|
511
|
+
.. code-block:: python
|
|
512
|
+
|
|
513
|
+
from socketdev import socketdev
|
|
514
|
+
socket = socketdev(token="REPLACE_ME")
|
|
515
|
+
print(socket.report.list(from_time=1726183485))
|
|
516
|
+
|
|
517
|
+
**PARAMETERS:**
|
|
518
|
+
|
|
519
|
+
- **from_time (int)** - The Unix Timestamp in Seconds to limit the reports pulled
|
|
520
|
+
|
|
521
|
+
Deprecated: report.delete(report_id)
|
|
522
|
+
""""""""""""""""""""""""""""""""""""
|
|
523
|
+
Delete the specified report
|
|
524
|
+
|
|
525
|
+
**Usage:**
|
|
526
|
+
|
|
527
|
+
.. code-block:: python
|
|
528
|
+
|
|
529
|
+
from socketdev import socketdev
|
|
530
|
+
socket = socketdev(token="REPLACE_ME")
|
|
531
|
+
print(socket.report.delete("report-id"))
|
|
532
|
+
|
|
533
|
+
**PARAMETERS:**
|
|
534
|
+
|
|
535
|
+
- **report_id (str)** - The report ID of the report to delete
|
|
536
|
+
|
|
537
|
+
Deprecated: report.view(report_id)
|
|
538
|
+
""""""""""""""""""""""""""""""""""
|
|
539
|
+
Retrieve the information for a Project Health Report
|
|
540
|
+
|
|
541
|
+
**Usage:**
|
|
542
|
+
|
|
543
|
+
.. code-block:: python
|
|
544
|
+
|
|
545
|
+
from socketdev import socketdev
|
|
546
|
+
socket = socketdev(token="REPLACE_ME")
|
|
547
|
+
print(socket.report.view("report_id"))
|
|
548
|
+
|
|
549
|
+
**PARAMETERS:**
|
|
550
|
+
|
|
551
|
+
- **report_id (str)** - The report ID of the report to view
|
|
552
|
+
|
|
553
|
+
Deprecated: report.create(files)
|
|
554
|
+
""""""""""""""""""""""""""""""""
|
|
555
|
+
Create a new project health report with the provided files
|
|
556
|
+
|
|
557
|
+
**Usage:**
|
|
558
|
+
|
|
559
|
+
.. code-block:: python
|
|
560
|
+
|
|
561
|
+
from socketdev import socketdev
|
|
562
|
+
socket = socketdev(token="REPLACE_ME")
|
|
563
|
+
files = [
|
|
564
|
+
"/path/to/manifest/package.json"
|
|
565
|
+
]
|
|
566
|
+
print(socket.report.create(files))
|
|
567
|
+
|
|
568
|
+
**PARAMETERS:**
|
|
569
|
+
|
|
570
|
+
- **files (list)** - List of file paths of manifest files
|
|
571
|
+
|
|
572
|
+
Deprecated: repositories.get()
|
|
573
|
+
""""""""""""""""""""""""""""""
|
|
574
|
+
Get a list of information about the tracked repositores
|
|
575
|
+
|
|
576
|
+
**Usage:**
|
|
577
|
+
|
|
578
|
+
.. code-block:: python
|
|
579
|
+
|
|
580
|
+
from socketdev import socketdev
|
|
581
|
+
socket = socketdev(token="REPLACE_ME")
|
|
582
|
+
print(socket.repositories.get())
|
|
583
|
+
|
|
584
|
+
Deprecated: sbom.view(report_id)
|
|
585
|
+
""""""""""""""""""""""""""""""""
|
|
586
|
+
Retrieve the information for a SBOM Report
|
|
587
|
+
|
|
588
|
+
**Usage:**
|
|
589
|
+
|
|
590
|
+
.. code-block:: python
|
|
591
|
+
|
|
592
|
+
from socketdev import socketdev
|
|
593
|
+
socket = socketdev(token="REPLACE_ME")
|
|
594
|
+
print(socket.sbom.view("report_id"))
|
|
595
|
+
|
|
596
|
+
Deprecated: npm.issues(package, version)
|
|
597
|
+
""""""""""""""""""""""""""""""""""""""""
|
|
598
|
+
Retrieve the Issues associated with a package and version.
|
|
599
|
+
|
|
600
|
+
**Usage:**
|
|
601
|
+
|
|
602
|
+
.. code-block:: python
|
|
603
|
+
|
|
604
|
+
from socketdev import socketdev
|
|
605
|
+
socket = socketdev(token="REPLACE_ME")
|
|
606
|
+
print(socket.npm.issues("hardhat-gas-report", "1.1.25"))
|
|
607
|
+
|
|
608
|
+
**PARAMETERS:**
|
|
609
|
+
|
|
610
|
+
- **package (str)** - The name of the NPM package.
|
|
611
|
+
- **version (str)** - The version of the NPM Package.
|
|
612
|
+
|
|
613
|
+
Deprecated: npm.score(package, version)
|
|
614
|
+
"""""""""""""""""""""""""""""""""""""""
|
|
615
|
+
Retrieve the Issues associated with a package and version.
|
|
616
|
+
|
|
617
|
+
**Usage:**
|
|
618
|
+
|
|
619
|
+
.. code-block:: python
|
|
620
|
+
|
|
621
|
+
from socketdev import socketdev
|
|
622
|
+
socket = socketdev(token="REPLACE_ME")
|
|
623
|
+
print(socket.npm.score("hardhat-gas-report", "1.1.25"))
|
|
624
|
+
|
|
625
|
+
**PARAMETERS:**
|
|
626
|
+
|
|
627
|
+
- **package (str)** - The name of the NPM package.
|
|
628
|
+
- **version (str)** - The version of the NPM Package.
|
|
629
|
+
|
|
630
|
+
labels.list(org_slug)
|
|
631
|
+
"""""""""""""""""""""""
|
|
632
|
+
List all repository labels for the given organization.
|
|
633
|
+
|
|
634
|
+
**Usage:**
|
|
635
|
+
|
|
636
|
+
.. code-block:: python
|
|
637
|
+
|
|
638
|
+
from socketdev import socketdev
|
|
639
|
+
|
|
640
|
+
socket = socketdev(token="REPLACE_ME")
|
|
641
|
+
print(socket.labels.list("org_slug"))
|
|
642
|
+
|
|
643
|
+
**PARAMETERS:**
|
|
644
|
+
|
|
645
|
+
- **org_slug (str)** – The organization name
|
|
646
|
+
|
|
647
|
+
labels.post(org_slug, label_name)
|
|
648
|
+
"""""""""""""""""""""""""""""""""""
|
|
649
|
+
Create a new label in the organization.
|
|
650
|
+
|
|
651
|
+
**Usage:**
|
|
652
|
+
|
|
653
|
+
.. code-block:: python
|
|
654
|
+
|
|
655
|
+
print(socket.labels.post("org_slug", "my-label"))
|
|
656
|
+
|
|
657
|
+
**PARAMETERS:**
|
|
658
|
+
|
|
659
|
+
- **org_slug (str)** – The organization name
|
|
660
|
+
- **label_name (str)** – Name of the label to create
|
|
661
|
+
|
|
662
|
+
labels.get(org_slug, label_id)
|
|
663
|
+
"""""""""""""""""""""""""""""""""
|
|
664
|
+
Retrieve a single label by its ID.
|
|
665
|
+
|
|
666
|
+
**Usage:**
|
|
667
|
+
|
|
668
|
+
.. code-block:: python
|
|
669
|
+
|
|
670
|
+
print(socket.labels.get("org_slug", "label_id"))
|
|
671
|
+
|
|
672
|
+
**PARAMETERS:**
|
|
673
|
+
|
|
674
|
+
- **org_slug (str)** – The organization name
|
|
675
|
+
- **label_id (str)** – The label ID
|
|
676
|
+
|
|
677
|
+
labels.delete(org_slug, label_id)
|
|
678
|
+
"""""""""""""""""""""""""""""""""""
|
|
679
|
+
Delete a label by ID.
|
|
680
|
+
|
|
681
|
+
**Usage:**
|
|
682
|
+
|
|
683
|
+
.. code-block:: python
|
|
684
|
+
|
|
685
|
+
print(socket.labels.delete("org_slug", "label_id"))
|
|
686
|
+
|
|
687
|
+
**PARAMETERS:**
|
|
688
|
+
|
|
689
|
+
- **org_slug (str)** – The organization name
|
|
690
|
+
- **label_id (str)** – The label ID
|
|
691
|
+
|
|
692
|
+
labels.associate(org_slug, label_id, repo_id)
|
|
693
|
+
"""""""""""""""""""""""""""""""""""""""""""""""
|
|
694
|
+
Associate a label with a repository.
|
|
695
|
+
|
|
696
|
+
**Usage:**
|
|
697
|
+
|
|
698
|
+
.. code-block:: python
|
|
699
|
+
|
|
700
|
+
print(socket.labels.associate("org_slug", 1234, "repo_id"))
|
|
701
|
+
|
|
702
|
+
**PARAMETERS:**
|
|
703
|
+
|
|
704
|
+
- **org_slug (str)** – The organization name
|
|
705
|
+
- **label_id (int)** – The label ID
|
|
706
|
+
- **repo_id (str)** – The repository ID
|
|
707
|
+
|
|
708
|
+
labels.disassociate(org_slug, label_id, repo_id)
|
|
709
|
+
"""""""""""""""""""""""""""""""""""""""""""""""""
|
|
710
|
+
Disassociate a label from a repository.
|
|
711
|
+
|
|
712
|
+
**Usage:**
|
|
713
|
+
|
|
714
|
+
.. code-block:: python
|
|
715
|
+
|
|
716
|
+
print(socket.labels.disassociate("org_slug", 1234, "repo_id"))
|
|
717
|
+
|
|
718
|
+
**PARAMETERS:**
|
|
719
|
+
|
|
720
|
+
- **org_slug (str)** – The organization name
|
|
721
|
+
- **label_id (int)** – The label ID
|
|
722
|
+
- **repo_id (str)** – The repository ID
|
|
723
|
+
|
|
724
|
+
labels.setting.get(org_slug, label_id, setting_key)
|
|
725
|
+
"""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
726
|
+
Get a setting for a specific label.
|
|
727
|
+
|
|
728
|
+
**Usage:**
|
|
729
|
+
|
|
730
|
+
.. code-block:: python
|
|
731
|
+
|
|
732
|
+
print(socket.labels.setting.get("org_slug", 1234, "severity"))
|
|
733
|
+
|
|
734
|
+
**PARAMETERS:**
|
|
735
|
+
|
|
736
|
+
- **org_slug (str)** – The organization name
|
|
737
|
+
- **label_id (int)** – The label ID
|
|
738
|
+
- **setting_key (str)** – The key of the setting
|
|
739
|
+
|
|
740
|
+
labels.setting.put(org_slug, label_id, settings)
|
|
741
|
+
"""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
742
|
+
Update settings for a specific label.
|
|
743
|
+
|
|
744
|
+
**Usage:**
|
|
745
|
+
|
|
746
|
+
.. code-block:: python
|
|
747
|
+
|
|
748
|
+
settings = {"severity": {"value": {"level": "high"}}}
|
|
749
|
+
print(socket.labels.setting.put("org_slug", 1234, settings))
|
|
750
|
+
|
|
751
|
+
**PARAMETERS:**
|
|
752
|
+
|
|
753
|
+
- **org_slug (str)** – The organization name
|
|
754
|
+
- **label_id (int)** – The label ID
|
|
755
|
+
- **settings (dict)** – A dictionary of label settings
|
|
756
|
+
|
|
757
|
+
labels.setting.delete(org_slug, label_id, setting_key)
|
|
758
|
+
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
759
|
+
Delete a setting from a label.
|
|
760
|
+
|
|
761
|
+
**Usage:**
|
|
762
|
+
|
|
763
|
+
.. code-block:: python
|
|
764
|
+
|
|
765
|
+
print(socket.labels.setting.delete("org_slug", 1234, "severity"))
|
|
766
|
+
|
|
767
|
+
**PARAMETERS:**
|
|
768
|
+
|
|
769
|
+
- **org_slug (str)** – The organization name
|
|
770
|
+
- **label_id (int)** – The label ID
|
|
771
|
+
- **setting_key (str)** – The setting key to delete
|
|
772
|
+
|
|
773
|
+
historical.list(org_slug, query_params=None)
|
|
774
|
+
"""""""""""""""""""""""""""""""""""""""""""""""
|
|
775
|
+
List historical alerts for an organization.
|
|
776
|
+
|
|
777
|
+
**Usage:**
|
|
778
|
+
|
|
779
|
+
.. code-block:: python
|
|
780
|
+
|
|
781
|
+
print(socket.historical.list("org_slug", {"repo": "example-repo"}))
|
|
782
|
+
|
|
783
|
+
**PARAMETERS:**
|
|
784
|
+
|
|
785
|
+
- **org_slug (str)** – The organization name
|
|
786
|
+
- **query_params (dict, optional)** – Optional query parameters
|
|
787
|
+
|
|
788
|
+
historical.trend(org_slug, query_params=None)
|
|
789
|
+
"""""""""""""""""""""""""""""""""""""""""""""""
|
|
790
|
+
Retrieve alert trend data across time.
|
|
791
|
+
|
|
792
|
+
**Usage:**
|
|
793
|
+
|
|
794
|
+
.. code-block:: python
|
|
795
|
+
|
|
796
|
+
print(socket.historical.trend("org_slug", {"range": "30d"}))
|
|
797
|
+
|
|
798
|
+
**PARAMETERS:**
|
|
799
|
+
|
|
800
|
+
- **org_slug (str)** – The organization name
|
|
801
|
+
- **query_params (dict, optional)** – Optional query parameters
|
|
802
|
+
|
|
803
|
+
historical.snapshots.create(org_slug)
|
|
804
|
+
""""""""""""""""""""""""""""""""""""""""
|
|
805
|
+
Create a new snapshot of historical data.
|
|
806
|
+
|
|
807
|
+
**Usage:**
|
|
808
|
+
|
|
809
|
+
.. code-block:: python
|
|
810
|
+
|
|
811
|
+
print(socket.historical.snapshots.create("org_slug"))
|
|
812
|
+
|
|
813
|
+
**PARAMETERS:**
|
|
814
|
+
|
|
815
|
+
- **org_slug (str)** – The organization name
|
|
816
|
+
|
|
817
|
+
historical.snapshots.list(org_slug, query_params=None)
|
|
818
|
+
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
819
|
+
List all historical snapshots for an organization.
|
|
820
|
+
|
|
821
|
+
**Usage:**
|
|
822
|
+
|
|
823
|
+
.. code-block:: python
|
|
824
|
+
|
|
825
|
+
print(socket.historical.snapshots.list("org_slug", {"repo": "example-repo"}))
|
|
826
|
+
|
|
827
|
+
**PARAMETERS:**
|
|
828
|
+
|
|
829
|
+
- **org_slug (str)** – The organization name
|
|
830
|
+
- **query_params (dict, optional)** – Optional query parameters
|