-
Notifications
You must be signed in to change notification settings - Fork 731
Expand file tree
/
Copy pathopenapi.yaml
More file actions
366 lines (351 loc) · 10.9 KB
/
Copy pathopenapi.yaml
File metadata and controls
366 lines (351 loc) · 10.9 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
openapi: 3.0.3
info:
title: CDP → Akrites External API
version: 0.1.0
description: >
Read-only external API exposing CDP package security data to the Akrites
service. Authenticated via Auth0 M2M client-credentials — CDP only
verifies the resulting access token; the assertion exchange happens
entirely between Akrites and Auth0.
Only the Packages endpoints are implemented so far. Advisories, Blast
Radius, and Contacts are specced separately and not yet built.
TODO: scopes below (read:packages, read:stewardships) are the existing
internal CDP UI scopes, reused here for now. Swap for a dedicated
cdp:packages:read scope once Akrites gets its own Auth0 M2M scopes per
the akrites-external draft contract.
servers:
- url: https://cm.lfx.dev/api/v1
description: Production
security:
- M2MBearer:
- read:packages
- read:stewardships
tags:
- name: Packages
description: Package detail — requires read:packages and read:stewardships (see TODO above).
components:
securitySchemes:
M2MBearer:
type: http
scheme: bearer
bearerFormat: JWT
schemas:
Error:
type: object
required: [error]
properties:
error:
type: object
required: [code, message]
properties:
code:
type: string
example: BAD_REQUEST
message:
type: string
Ecosystem:
type: string
example: npm
HealthBand:
type: string
enum: [critical, low, medium, high]
description: >
UNCONFIRMED CROSSWALK — the internal health scale is
excellent/healthy/fair/concerning/critical (good→bad); there is no
agreed mapping to this critical/low/medium/high scale yet. See
HEALTH_BAND_CROSSWALK in akritesExternalPackageDetail.ts. Confirm
with Akrites/product before relying on exact band values.
PackageDetail:
type: object
required:
- purl
- name
- ecosystem
- latestVersion
- versionCount
- health
- impact
- riskSignals
- security
- provenance
- supplyChainIntegrity
properties:
purl:
type: string
name:
type: string
ecosystem:
$ref: '#/components/schemas/Ecosystem'
latestVersion:
type: string
nullable: true
versionCount:
type: integer
nullable: true
health:
type: object
required: [score, band, subScores, signalCoverageHealth]
properties:
score:
type: integer
nullable: true
minimum: 0
maximum: 100
band:
$ref: '#/components/schemas/HealthBand'
subScores:
type: object
required: [maintainerHealth, securitySupplyChain, developmentActivity]
properties:
maintainerHealth:
type: number
nullable: true
securitySupplyChain:
type: number
nullable: true
developmentActivity:
type: number
nullable: true
signalCoverageHealth:
type: object
nullable: true
additionalProperties: true
impact:
type: object
required: [score, downloadsLast30Days, dependentPackagesCount, dependentReposCount, transitiveReach]
properties:
score:
type: integer
nullable: true
minimum: 0
maximum: 100
downloadsLast30Days:
type: string
nullable: true
description: Raw registry count string, not normalized.
dependentPackagesCount:
type: integer
nullable: true
dependentReposCount:
type: integer
nullable: true
transitiveReach:
type: integer
nullable: true
description: Always null for now — reserved for future computation.
riskSignals:
type: object
required:
- lifecycle
- maintainerBusFactor
- lastReleaseAt
- hasSecurityFile
- hasSecurityPolicy
- branchProtectionEnabled
- openssfScorecardScore
properties:
lifecycle:
type: string
enum: [active, inactive, deprecated, abandoned, null]
nullable: true
description: >
UNCONFIRMED CROSSWALK from the internal
active/stable/declining/abandoned/archived scale — see
LIFECYCLE_CROSSWALK in akritesExternalPackageDetail.ts.
maintainerBusFactor:
type: integer
nullable: true
lastReleaseAt:
type: string
format: date-time
nullable: true
hasSecurityFile:
type: boolean
nullable: true
hasSecurityPolicy:
type: boolean
nullable: true
branchProtectionEnabled:
type: boolean
nullable: true
openssfScorecardScore:
type: number
format: float
minimum: 0
maximum: 10
nullable: true
security:
type: object
required: [securityPolicyUrl, vulnerabilityReportingUrl, bugBountyUrl, pvrEnabled, criticalVulnerabilityFlag]
properties:
securityPolicyUrl:
type: string
nullable: true
vulnerabilityReportingUrl:
type: string
nullable: true
bugBountyUrl:
type: string
nullable: true
pvrEnabled:
type: boolean
nullable: true
criticalVulnerabilityFlag:
type: boolean
nullable: true
provenance:
type: object
required: [resolvedRepositoryUrl, declaredRepositoryUrl, mappingConfidenceScore, mappingConfidenceLabel, lastCommitAt]
properties:
resolvedRepositoryUrl:
type: string
nullable: true
description: >
From the confidence-ranked package_repos → repos join — the
repo CDP has actually resolved and enriched (scorecard,
branch protection, etc.).
declaredRepositoryUrl:
type: string
nullable: true
description: Raw repository URL as declared in the package's own metadata.
mappingConfidenceScore:
type: number
format: float
minimum: 0
maximum: 1
nullable: true
mappingConfidenceLabel:
type: string
enum: [High, Medium, Low, null]
nullable: true
lastCommitAt:
type: string
format: date-time
nullable: true
supplyChainIntegrity:
type: object
required: [buildProvenance, signedReleases]
properties:
buildProvenance:
type: string
nullable: true
description: Always null for now — reserved.
signedReleases:
type: string
nullable: true
description: Always null for now — reserved.
PackageDetailBulkEntry:
type: object
required: [requestedPurl, found, package]
properties:
requestedPurl:
type: string
found:
type: boolean
package:
type: object
nullable: true
allOf:
- $ref: '#/components/schemas/PackageDetail'
paths:
/akrites-external/packages/detail:
get:
operationId: getPackageDetail
summary: Get package detail by PURL
tags: [Packages]
security:
- M2MBearer:
- read:packages
- read:stewardships
parameters:
- name: purl
in: query
required: true
schema:
type: string
example: pkg:npm/%40angular/core
responses:
'200':
description: Package detail.
content:
application/json:
schema:
$ref: '#/components/schemas/PackageDetail'
'400':
description: Malformed purl.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'401':
description: Missing or invalid bearer token.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Token missing read:packages or read:stewardships scope.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Package not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/akrites-external/packages/detail:batch:
post:
operationId: getPackageDetailBatch
summary: Bulk package detail lookup
tags: [Packages]
security:
- M2MBearer:
- read:packages
- read:stewardships
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [purls]
properties:
purls:
type: array
minItems: 1
maxItems: 100
items:
type: string
responses:
'200':
description: Results in the same order as the request.
content:
application/json:
schema:
type: object
required: [results]
properties:
results:
type: array
items:
$ref: '#/components/schemas/PackageDetailBulkEntry'
'400':
description: Validation error (empty array, >100 items, malformed purl).
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'401':
description: Missing or invalid bearer token.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Token missing read:packages or read:stewardships scope.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'