99 entirely between Akrites and Auth0.
1010
1111
12- Only the Packages endpoints are implemented so far. Advisories, Blast
13- Radius, and Contacts are specced separately and not yet built.
12+ Packages and Advisories endpoints are implemented. Blast Radius and
13+ Contacts are specced separately and not yet built.
1414
1515
1616 TODO: scopes below (read:packages, read:stewardships) are the existing
@@ -30,6 +30,13 @@ security:
3030tags :
3131 - name : Packages
3232 description : Package detail — requires read:packages and read:stewardships (see TODO above).
33+ - name : Advisories
34+ description : >
35+ Security advisories for a package, split out of package detail. The draft
36+ contract gates these behind a dedicated read:advisories scope; until Auth0
37+ issues it, the implementation reuses read:packages (advisories need no
38+ stewardship read). Confirm the final scope name (read:advisories vs
39+ cdp:advisories:read) with Akrites/product.
3340
3441components :
3542 securitySchemes :
@@ -298,6 +305,57 @@ components:
298305 allOf :
299306 - $ref : ' #/components/schemas/PackageDetail'
300307
308+ Advisory :
309+ type : object
310+ required : [osvId, severity, resolution, isCritical]
311+ properties :
312+ osvId :
313+ type : string
314+ example : GHSA-xxxx-xxxx-xxxx
315+ severity :
316+ type : string
317+ enum : [critical, high, moderate, low, null]
318+ nullable : true
319+ description : >
320+ Lowercased advisory severity. Any stored value outside this enum is
321+ returned as null rather than echoed verbatim.
322+ resolution :
323+ type : string
324+ enum : [open, patched, null]
325+ nullable : true
326+ description : >
327+ Whether the package's latest version is still affected. Null when it
328+ can't be determined (no latest version, or no affected ranges recorded).
329+ isCritical :
330+ type : boolean
331+ nullable : true
332+ description : cvss >= 7.0. Null when the advisory has no CVSS score.
333+
334+ AdvisoryDetail :
335+ type : object
336+ required : [purl, advisories]
337+ properties :
338+ purl :
339+ type : string
340+ advisories :
341+ type : array
342+ items :
343+ $ref : ' #/components/schemas/Advisory'
344+
345+ AdvisoryDetailBulkEntry :
346+ type : object
347+ required : [requestedPurl, found, advisories]
348+ properties :
349+ requestedPurl :
350+ type : string
351+ found :
352+ type : boolean
353+ advisories :
354+ type : object
355+ nullable : true
356+ allOf :
357+ - $ref : ' #/components/schemas/AdvisoryDetail'
358+
301359paths :
302360 /akrites-external/packages/detail :
303361 get :
@@ -401,3 +459,104 @@ paths:
401459 application/json :
402460 schema :
403461 $ref : ' #/components/schemas/Error'
462+
463+ /akrites-external/advisories/detail :
464+ get :
465+ operationId : getAdvisoryDetail
466+ summary : Get advisories for a package by PURL
467+ tags : [Advisories]
468+ security :
469+ - M2MBearer :
470+ - read:packages
471+ parameters :
472+ - name : purl
473+ in : query
474+ required : true
475+ schema :
476+ type : string
477+ example : pkg:npm/%40angular/core
478+ responses :
479+ ' 200 ' :
480+ description : Advisories for the package (empty array when the package has none).
481+ content :
482+ application/json :
483+ schema :
484+ $ref : ' #/components/schemas/AdvisoryDetail'
485+ ' 400 ' :
486+ description : Malformed purl.
487+ content :
488+ application/json :
489+ schema :
490+ $ref : ' #/components/schemas/Error'
491+ ' 401 ' :
492+ description : Missing or invalid bearer token.
493+ content :
494+ application/json :
495+ schema :
496+ $ref : ' #/components/schemas/Error'
497+ ' 403 ' :
498+ description : Token missing read:packages scope.
499+ content :
500+ application/json :
501+ schema :
502+ $ref : ' #/components/schemas/Error'
503+ ' 404 ' :
504+ description : Package not found.
505+ content :
506+ application/json :
507+ schema :
508+ $ref : ' #/components/schemas/Error'
509+
510+ /akrites-external/advisories/detail:batch :
511+ post :
512+ operationId : getAdvisoryDetailBatch
513+ summary : Bulk advisory lookup
514+ tags : [Advisories]
515+ security :
516+ - M2MBearer :
517+ - read:packages
518+ requestBody :
519+ required : true
520+ content :
521+ application/json :
522+ schema :
523+ type : object
524+ required : [purls]
525+ properties :
526+ purls :
527+ type : array
528+ minItems : 1
529+ maxItems : 100
530+ items :
531+ type : string
532+ responses :
533+ ' 200 ' :
534+ description : Results in the same order as the request.
535+ content :
536+ application/json :
537+ schema :
538+ type : object
539+ required : [results]
540+ properties :
541+ results :
542+ type : array
543+ items :
544+ $ref : ' #/components/schemas/AdvisoryDetailBulkEntry'
545+ ' 400 ' :
546+ description : Validation error (empty array, >100 items, malformed purl).
547+ content :
548+ application/json :
549+ schema :
550+ $ref : ' #/components/schemas/Error'
551+ ' 401 ' :
552+ description : Missing or invalid bearer token.
553+ content :
554+ application/json :
555+ schema :
556+ $ref : ' #/components/schemas/Error'
557+ ' 403 ' :
558+ description : Token missing read:packages scope.
559+ content :
560+ application/json :
561+ schema :
562+ $ref : ' #/components/schemas/Error'
0 commit comments