-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsocket-metadata-api-openapi.yml
More file actions
525 lines (503 loc) · 18.8 KB
/
socket-metadata-api-openapi.yml
File metadata and controls
525 lines (503 loc) · 18.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
openapi: 3.0.0
info:
description: Socket metadata API endpoints.
title: Socket Metadata API
version: '0'
servers:
- url: https://api.socket.dev/v0
paths:
/orgs/{org_slug}/supported-files:
get:
tags:
- metadata
- full-scans
- diff-scans
summary: Get supported file types
operationId: getSupportedFiles
parameters:
- name: org_slug
in: path
required: true
description: The slug of the organization
schema:
type: string
security:
- bearerAuth: []
- basicAuth: []
description: 'Get a list of supported files for full scan generation.
Files are categorized first by environment (e.g. NPM or PyPI), then by name.
Files whose names match the patterns returned by this endpoint can be uploaded for report generation.
Examples of supported filenames include `package.json`, `package-lock.json`, and `yarn.lock`.
This endpoint consumes 1 unit of your quota.
This endpoint requires the following org token scopes:
- No Scopes Required, but authentication is required'
responses:
'200':
content:
application/json:
schema:
type: object
additionalProperties:
type: object
additionalProperties:
type: object
additionalProperties: false
description: ''
properties:
pattern:
type: string
description: ''
default: ''
required:
- pattern
properties: {}
description: ''
properties: {}
description: ''
description: Glob patterns used to match supported files
'400':
$ref: '#/components/responses/SocketBadRequest'
'404':
$ref: '#/components/responses/SocketNotFoundResponse'
'429':
$ref: '#/components/responses/SocketTooManyRequestsResponse'
x-readme: {}
/license-metadata:
post:
tags:
- metadata
- license-policy
summary: License Metadata
operationId: licenseMetadata
parameters:
- name: includetext
in: query
required: false
description: If `true`, the response will include the full text of the requested licenses
schema:
type: boolean
default: false
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/SLicenseMetaReq'
required: false
security: []
description: "For an array of license identifiers or names (short form SPDX identifiers, or long form license names),\n returns an array of metadata for the corresponding license, if the license\
\ is recognized. If the query\n parameter `includetext=true` is set, the returned metadata will also include the license text.\n\n\n ## Example request body:\n\n ```json\n [\n \"\
Apache-2.0\",\n \"BSD Zero Clause License\"\n ]\n ```\n\n\n ## Return value\n\n ```json\n // Response schema:\n Array<{\n licenseId: string,\n name?: string,\n \
\ deprecated?: string,\n crossref?: string\n classes: Array<string>\n text?: string\n }>\n\n // Example response:\n [\n {\n \"licenseId\": \"Apache-2.0\"\
,\n \"name\": \"Apache License 2.0\",\n \"deprecated\": false,\n \"crossref\": \"https://spdx.org/licenses/Apache-2.0.html\",\n \"classes\": [\n \"fsf libre\"\
,\n \"osi approved\",\n \"permissive (silver)\"\n ]\n },\n {\n \"licenseId\": \"0BSD\",\n \"name\": \"BSD Zero Clause License\",\n \"deprecated\"\
: false,\n \"crossref\": \"https://spdx.org/licenses/0BSD.html\",\n \"classes\": [\n \"osi approved\",\n \"permissive (bronze)\"\n ]\n }\n ]\n ```\n\
\n ## License policy schema\n\n```json\n{\n allow?: Array<string>\n warn?: Array<string>\n options?: Array<string>\n}\n```\n\nElements of the `allow` and `warn` arrays strings representing\
\ items which should be allowed, or which should trigger a warning; license data found in package which not present in either array will produce a license violation (effectively a \"hard\" error).\
\ For example, to allow Apache-2.0 and MIT to the allow list, simply add the strings \"Apache-2.0\" and \"MIT\" to the `allow` array. Strings appearing in these arrays are generally \"what you see\
\ is what you get\", with two important exceptions: strings which are recognized as license classes and strings which are recognized as PURLs are handled differently to allow for more flexible license\
\ policy creation.\n\n## License Classes\n\nStrings which are license classes will expand to a list of licenses known to be in that particular license class. Recognized license classes are:\n 'permissive',\n\
\ 'permissive (model)',\n 'permissive (gold)',\n 'permissive (silver)',\n 'permissive (bronze)',\n 'permissive (lead)',\n 'copyleft',\n 'maximal copyleft',\n 'network copyleft',\n 'strong\
\ copyleft',\n 'weak copyleft',\n 'contributor license agreement',\n 'public domain',\n 'proprietary free',\n 'source available',\n 'proprietary',\n 'commercial',\n 'patent'\n\nUsers can\
\ learn more about [copyleft tiers](https://blueoakcouncil.org/copyleft) and [permissive tiers](https://blueoakcouncil.org/list) by reading the linked resources.\n\n\n## PURLs\n\nUsers may also\
\ modify their license policy's allow and warn lists by using [package URLs](https://github.com/package-url/purl-spec) (aka PURLs), which support glob patterns to allow a range of versions, files\
\ and directories, etc.\n\npurl qualifiers which support globs are `filename`, `version_glob`, `artifact_id` and `license_provenance` (primarily used for allowing data from registry metadata).\n\
\n### Examples:\nAllow all license data found in a specific version of a package 4.14.1: `pkg:npm/lodash@4.14.1`\nAllow all license data found in a version range of a package: `pkg:npm/lodash?version_glob=15.*`\n\
Allow all license data in the test directory of a given package for certain version ranges: `pkg:npm/lodash@15.*.*?file_name=lodash/test/*`\nAllow all license data taken from the package registry\
\ for a package and version range: `pkg:npm/lodash?version_glob=*&license_provenance=registry_metadata`\n\n## Available options\n\n`toplevelOnly`: only apply the license policy to \"top level\"\
\ license data in a package, which includes registry metadata, LICENSE files, and manifest files which are closest to the root of the package.\n\n`applyToUnidentified`: Apply license policy to found\
\ but unidentified license data. If enabled, the license policy will be applied to license data which could not be affirmatively identified as a known license (this will effectively merge the license\
\ policy violation and unidentified license alerts). If disabled, license policy alerts will only be shown for license data which is positively identified as something not allowed or set to warn\
\ by the license policy.\n\nThis endpoint consumes 1 unit of your quota.\n\nThis endpoint requires the following org token scopes:"
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/SLicenseMetaRes'
description: Metadata for the requested licenses
'400':
$ref: '#/components/responses/SocketBadRequest'
x-readme: {}
/alert-types:
post:
tags:
- metadata
- full-scans
- diff-scans
summary: Alert Types Metadata
operationId: alertTypes
parameters:
- name: language
in: query
required: false
description: Language for alert metadata
schema:
type: string
enum:
- ach-UG
- de-DE
- en-US
- es-ES
- fr-FR
- it-IT
default: en-US
requestBody:
content:
application/json:
schema:
type: array
items:
type: string
description: ''
default: ''
description: ''
required: false
security: []
description: 'For an array of alert type identifiers, returns metadata for each alert type. Optionally, specify a language via the ''language'' query parameter.
This endpoint consumes 1 unit of your quota.
This endpoint requires the following org token scopes:'
responses:
'200':
content:
application/json:
schema:
type: array
items:
type: object
additionalProperties: false
description: ''
properties:
type:
type: string
description: ''
default: ''
title:
type: string
description: ''
default: ''
description:
type: string
description: ''
default: ''
suggestion:
type: string
description: ''
default: ''
emoji:
type: string
description: ''
default: ''
nextStepTitle:
type: string
description: ''
default: ''
props:
type: object
additionalProperties:
type: string
description: ''
default: ''
properties: {}
description: ''
nullable: true
required:
- description
- emoji
- nextStepTitle
- props
- suggestion
- title
- type
description: ''
description: Metadata for the requested alert types
'400':
$ref: '#/components/responses/SocketBadRequest'
x-readme: {}
/openapi:
get:
tags:
- metadata
summary: Returns the OpenAPI definition
operationId: getOpenAPI
security: []
description: 'Retrieve the API specification in an Openapi JSON format.
This endpoint consumes 1 unit of your quota.
This endpoint requires the following org token scopes:'
responses:
'200':
content:
application/json: {}
description: OpenAPI specification
'429':
$ref: '#/components/responses/SocketTooManyRequestsResponse'
x-readme: {}
/openapi.json:
get:
tags:
- metadata
summary: Returns the OpenAPI definition
operationId: getOpenAPIJSON
security: []
description: 'Retrieve the API specification in an Openapi JSON format.
This endpoint consumes 1 unit of your quota.
This endpoint requires the following org token scopes:'
responses:
'200':
content:
application/json: {}
description: OpenAPI specification
'429':
$ref: '#/components/responses/SocketTooManyRequestsResponse'
x-readme: {}
components:
requestBodies: {}
responses:
SocketBadRequest:
content:
application/json:
schema:
type: object
additionalProperties: false
description: ''
properties:
error:
type: object
additionalProperties: false
description: ''
properties:
message:
type: string
description: ''
default: ''
details:
type: object
description: ''
default: null
nullable: true
required:
- details
- message
required:
- error
description: Bad request
SocketUnauthorized:
content:
application/json:
schema:
type: object
additionalProperties: false
description: ''
properties:
error:
type: object
additionalProperties: false
description: ''
properties:
message:
type: string
description: ''
default: ''
details:
type: object
description: ''
default: null
nullable: true
required:
- details
- message
required:
- error
description: Unauthorized
SocketForbidden:
content:
application/json:
schema:
type: object
additionalProperties: false
description: ''
properties:
error:
type: object
additionalProperties: false
description: ''
properties:
message:
type: string
description: ''
default: ''
details:
type: object
description: ''
default: null
nullable: true
required:
- details
- message
required:
- error
description: Insufficient max_quota for API method
SocketNotFoundResponse:
content:
application/json:
schema:
type: object
additionalProperties: false
description: ''
properties:
error:
type: object
additionalProperties: false
description: ''
properties:
message:
type: string
description: ''
default: ''
details:
type: object
description: ''
default: null
nullable: true
required:
- details
- message
required:
- error
description: Resource not found
SocketTooManyRequestsResponse:
description: Insufficient quota for API route
headers:
Retry-After:
description: 'Retry contacting the endpoint *at least* after seconds.
See https://tools.ietf.org/html/rfc7231#section-7.1.3'
schema:
format: int32
type: integer
content:
application/json:
schema:
type: object
additionalProperties: false
description: ''
properties:
error:
type: object
additionalProperties: false
description: ''
properties:
message:
type: string
description: ''
default: ''
details:
type: object
description: ''
default: null
nullable: true
required:
- details
- message
required:
- error
SocketInternalServerError:
content:
application/json:
schema:
type: object
additionalProperties: false
description: ''
properties:
error:
type: object
additionalProperties: false
description: ''
properties:
message:
type: string
description: ''
default: ''
details:
type: object
description: ''
default: null
nullable: true
required:
- details
- message
required:
- error
description: Internal server error
SocketConflict:
content:
application/json:
schema:
type: object
additionalProperties: false
description: ''
properties:
error:
type: object
additionalProperties: false
description: ''
properties:
message:
type: string
description: ''
default: ''
details:
type: object
description: ''
default: null
nullable: true
required:
- details
- message
required:
- error
description: Resource already exists
SocketGone:
content:
application/json:
schema:
type: object
additionalProperties: false
description: ''
properties:
error:
type: object
additionalProperties: false
description: ''
properties:
message:
type: string
description: ''
default: ''
details:
type: object
description: ''
default: null
nullable: true
required:
- details
- message
required:
- error
description: Gone
schemas:
SLicenseMetaReq:
type: object
description: ''
default: null
SLicenseMetaRes:
type: object
description: ''
default: null
securitySchemes:
bearerAuth:
type: http
scheme: bearer
description: Organization Tokens can be passed as a Bearer token
basicAuth:
type: http
scheme: basic
description: Organization Tokens can be passed as the user field in basic auth