-
Notifications
You must be signed in to change notification settings - Fork 75
/
Copy pathopenapi.yml
288 lines (288 loc) · 9.22 KB
/
openapi.yml
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
openapi: "3.0.2"
info:
title: CVE Services API
description: The CVE services API which supports automation tooling for the CVE Project.
version: 0.1.0
contact:
"name": "CVE Services API"
"url": https://github.com/CVEProject/cve-services
"email": cve-board-auto-list@mitre.org
license:
name: Creative Commons Zero v1.0 Universal
url: https://creativecommons.org/publicdomain/zero/1.0/legalcode
termsOfService: https://placeholder.cve.mitre.org/api/terms
servers:
- url: https://cveawg-dev.mitre.org/api
description: Development and testing server
- url: https://api.cve.mitre.org/v1
description: Production server
components:
parameters:
cve-id-path:
name: cve-id
in: path
description: The CVE ID for which the record is being submitted
required: true
schema:
type: string
pattern: 'CVE-\d{4}-\d+'
org-shortname:
name: shortname
in: path
description: The shortname for an organization in the system
required: true
schema:
type: string
api-entity-header:
name: CVE-API-ORG
description: >
The shortname for the entity (e.g., CNA, ADP) that is authenticated or requesting authentication.
in: header
required: true
schema:
type: string
api-user-header:
name: CVE-API-USER
description: >
The username for the account that is making the request.
in: header
required: true
schema:
type: string
api-secret-header:
name: CVE-API-KEY
description: >
The user's api key. \[TODO:: Is there a pattern for the format?\]
in: header
required: true
schema:
type: string
schemas:
cve-id:
properties:
cve_id:
type: string
pattern: '^CVE-\d{4}-\d+$'
cve_year:
type: string
format: "YYYY"
owning_cna:
type: string
description: The shortname for the organization that owns the CVE-ID.
state:
type: string
enum: [RESERVED, PUBLIC, REJECT]
requested_by:
type: object
properties:
cna:
type: string
description: The shortname for the organization of the user that requested the ID.
user:
type: string
description: The username for the account that requested the ID.
reserved:
type: string
format: date-time
description: The time the ID was reserved.
time:
type: object
properties:
created:
type: string
format: date-time
description: The time the ID was created.
modified:
type: string
format: date-time
description: The last time the ID was modified.
ArrayOfCveIds:
type: object
properties:
cve_ids:
type: array
items:
$ref: '#/components/schemas/cve-id'
paths:
/org/{shortname}/id_quota:
get:
summary: Allows an Org to see details about their id_quota.
operationId: getIdQuota
parameters:
- "$ref": "#/components/parameters/api-entity-header"
- "$ref": "#/components/parameters/api-secret-header"
- "$ref": "#/components/parameters/api-user-header"
- "$ref": "#/components/parameters/org-shortname"
responses:
200:
description: Returns details of the organization's id_quota
content:
application/json:
schema:
type: object
properties:
id_quota:
type: number
description: The number of IDs the organization is allowed to have in the RESERVED state at one time.
total_reserved:
type: number
description: The total of IDs across all years that the organization has in the RESERVED state.
available:
type: number
description: id_quota - total_reserved
400:
description: Bad Request
401:
description: Not Authenticated
403:
description: Forbidden
404:
description: Not Found
500:
description: Internal Server Error
/cve-id:
get:
summary: Retrieves all CVE IDs entity owns.
parameters:
- "$ref": "#/components/parameters/api-entity-header"
- "$ref": "#/components/parameters/api-secret-header"
- "$ref": "#/components/parameters/api-user-header"
- in: query
name: state
schema:
type: string
description: Filter by CVE state. [RESERVED, PUBLIC, or REJECT]
- in: query
name: cve_id_year
schema:
type: integer
description: "Filter by the year in the CVE ID (YYYY)"
- in: query
name: time_reserved.lt
schema:
type: string
format: date-time
description: "Get all CVE IDs reserved before timestamp"
- in: query
name: time_reserved.gt
schema:
type: string
format: date-time
description: "Get all CVE IDs reserved after timestamp"
responses:
200:
description: A list of CVE IDs the organization owns and fit within the query parameters given.
content:
application/json:
schema:
$ref: '#/components/schemas/ArrayOfCveIds'
400:
description: Bad Request
401:
description: Not Authenticated
403:
description: Forbidden
404:
description: Not Found
500:
description: Internal Server Error
post:
summary: Reserves IDs for the organization provided in the short_name query parameter.
parameters:
- "$ref": "#/components/parameters/api-entity-header"
- "$ref": "#/components/parameters/api-secret-header"
- "$ref": "#/components/parameters/api-user-header"
- in: query
name: batch_type
schema:
type: string
enum: [sequential, nonsequential, non-sequential]
description: >
When amount is greater than one, indicates whether IDs should be sequential or nonsequential.
- in: query
name: amount
schema:
type: integer
required: true
description: Amount of IDs desired
- in: query
name: cve_year
schema:
type: integer
required: true
description: The year the IDs should be reserved for. [1999...current+1]
- in: query
name: short_name
schema:
type: string
required: true
description: >
Identifies the CNA who should own the IDs reserved.
responses:
200:
description: A list of the newly reserved CVE-IDs the account requested.
content:
application/json:
schema:
$ref: '#/components/schemas/ArrayOfCveIds'
206:
description: A partial list of the CVE-IDs the IDR managed to reserve before encountering a case where no more IDs could be reserved.
content:
application/json:
schema:
type: object
properties:
error:
type: string
description: The title of the error RESERVED_PARTIAL_AMOUNT
message:
type: string
description: An elaboration of the error
details:
type: object
properties:
amount_reserved:
type: number
description: The amount of IDs that were reserved in the system.
cve_ids:
type: array
items:
$ref: '#/components/schemas/cve-id'
400:
description: Bad Request
401:
description: Not Authenticated
403:
description: Forbidden
404:
description: Not Found
500:
description: Internal Server Error
/cve-id/{cve-id}:
parameters:
- "$ref": "#/components/parameters/cve-id-path"
get:
summary: Retrieves a CVE ID by ID, can be a CVE the entity doesn't own if in a PUBLIC or REJECT state.
operationId: getCVEIdById
parameters:
- "$ref": "#/components/parameters/api-entity-header"
- "$ref": "#/components/parameters/api-secret-header"
- "$ref": "#/components/parameters/api-user-header"
responses:
200:
description: >
The requested CVE ID is returned.
content:
application/json:
schema:
$ref: '#/components/schemas/cve-id'
400:
description: Bad Request
401:
description: Not Authenticated
403:
description: Forbidden
404:
description: Not Found
500:
description: Internal Server Error