diff --git a/csaf_2_1/mandatoryTests/mandatoryTest_6_1_42.js b/csaf_2_1/mandatoryTests/mandatoryTest_6_1_42.js index 343b7a53..9d8e69ed 100644 --- a/csaf_2_1/mandatoryTests/mandatoryTest_6_1_42.js +++ b/csaf_2_1/mandatoryTests/mandatoryTest_6_1_42.js @@ -48,7 +48,7 @@ const inputSchema = /** @type {const} */ ({ full_product_names: { elements: fullProductNameSchema, }, - relationships: { + product_paths: { elements: { additionalProperties: true, optionalProperties: { @@ -168,11 +168,11 @@ export function mandatoryTest_6_1_42(doc) { ) }) - doc.product_tree?.relationships?.forEach((relationship, index) => { - const fullProductName = relationship.full_product_name + doc.product_tree?.product_paths?.forEach((productPath, index) => { + const fullProductName = productPath.full_product_name if (fullProductName) { checkFullProductName( - `/product_tree/relationships/${index}/full_product_name`, + `/product_tree/product_paths/${index}/full_product_name`, fullProductName ) } diff --git a/tests/csaf_2_1/mandatoryTest_6_1_42.js b/tests/csaf_2_1/mandatoryTest_6_1_42.js index 145d289c..de07aef6 100644 --- a/tests/csaf_2_1/mandatoryTest_6_1_42.js +++ b/tests/csaf_2_1/mandatoryTest_6_1_42.js @@ -11,6 +11,26 @@ describe('mandatoryTest_6_1_42', function () { assert.equal(mandatoryTest_6_1_42({ product_tree: 'mydoc' }).isValid, true) }) + it('validates product_paths and skips invalid ones', function () { + assert.equal( + mandatoryTest_6_1_42({ + product_tree: { + product_paths: [ + { + full_product_name: { + purls: [ + 'pkg:oci/product-A@sha256%3Add134261219b2?repository_url=https://registry.example.com', + ], + }, + }, + {}, + ], + }, + }).isValid, + true + ) + }) + it('test checkPurls', function () { expect(checkPurls([]), 'empty purl array').to.eql([]) expect(checkPurls(['invalid']), 'invalid PURL').to.eql([])