@@ -42,10 +42,10 @@ const inputSchema = /** @type {const} */ ({
4242 content : {
4343 additionalProperties : true ,
4444 optionalProperties : {
45- ssvc_v1 : {
45+ ssvc_v2 : {
4646 additionalProperties : true ,
4747 optionalProperties : {
48- id : { type : 'string' } ,
48+ target_ids : { elements : { type : 'string' } } ,
4949 } ,
5050 } ,
5151 } ,
@@ -79,30 +79,30 @@ export function mandatoryTest_6_1_47(doc) {
7979
8080 doc . vulnerabilities . forEach ( ( vulnerability , vulnerabilityIndex ) => {
8181 vulnerability . metrics ?. forEach ( ( metric , metricIndex ) => {
82- if ( metric . content ?. ssvc_v1 ) {
83- const ssvcId = metric . content . ssvc_v1 . id
84- if ( ssvcId === doc . document . tracking ?. id ) {
85- if ( doc . vulnerabilities . length > 1 ) {
86- ctx . isValid = false
87- ctx . errors . push ( {
88- instancePath : `/vulnerabilities/${ vulnerabilityIndex } /metrics/${ metricIndex } /content/ssvc_v1/id` ,
89- message :
90- `the ssvc id equals the 'document/tracking/id' ` +
91- `even the csaf document has multiple vulnerabilities ` ,
92- } )
82+ if ( metric . content ?. ssvc_v2 ) {
83+ metric . content . ssvc_v2 . target_ids ?. forEach ( ( ssvcId , ssvcIdIndex ) => {
84+ if ( ssvcId === doc . document . tracking ?. id ) {
85+ if ( doc . vulnerabilities . length > 1 ) {
86+ ctx . isValid = false
87+ ctx . errors . push ( {
88+ instancePath : `/vulnerabilities/${ vulnerabilityIndex } /metrics/${ metricIndex } /content/ssvc_v2/${ ssvcIdIndex } ` ,
89+ message :
90+ `the ssvc id equals the "document/tracking/id" ` +
91+ `even the csaf document has multiple vulnerabilities ` ,
92+ } )
93+ }
9394 }
94- } else {
9595 const idTexts = vulnerability . ids ?. map ( ( id ) => id . text )
9696 if ( ssvcId !== vulnerability . cve && ! idTexts ?. includes ( ssvcId ) ) {
9797 ctx . isValid = false
9898 ctx . errors . push ( {
99- instancePath : `/vulnerabilities/${ vulnerabilityIndex } /metrics/${ metricIndex } /content/ssvc_v1/id ` ,
99+ instancePath : `/vulnerabilities/${ vulnerabilityIndex } /metrics/${ metricIndex } /content/ssvc_v2/ ${ ssvcIdIndex } ` ,
100100 message :
101- `the ssvc id does neither match the ' cve' ` +
102- `nor it matches the ' text' of any item in the ' ids' array` ,
101+ `the ssvc id does neither match the " cve" ` +
102+ `nor it matches the " text" of any item in the " ids" array` ,
103103 } )
104104 }
105- }
105+ } )
106106 }
107107 } )
108108 } )
0 commit comments