From 037a0e9661596d5de0d9ec750589b6b3e97c16f5 Mon Sep 17 00:00:00 2001 From: BaseCrusher Date: Wed, 4 Oct 2023 20:48:56 +0200 Subject: [PATCH 1/4] fix: trimComponents trims legitimate files Signed-off-by: BaseCrusher --- index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index e3f83675e..89c1d1458 100644 --- a/index.js +++ b/index.js @@ -4110,13 +4110,16 @@ export const trimComponents = (components, format) => { const filteredComponents = []; for (const comp of components) { if (format === "xml" && comp.component) { - const key = comp.component.purl || comp.component["bom-ref"]; + const key = + comp.component.purl || + comp.component["bom-ref"] || + comp.name + comp.version; if (!keyCache[key]) { keyCache[key] = true; filteredComponents.push(comp); } } else { - const key = comp.purl || comp["bom-ref"]; + const key = comp.purl || comp["bom-ref"] || comp.name + comp.version; if (!keyCache[key]) { keyCache[key] = true; filteredComponents.push(comp); From e4be5e89fcf0d84cf776c288df9c15143f25818d Mon Sep 17 00:00:00 2001 From: BaseCrusher Date: Thu, 5 Oct 2023 11:04:55 +0200 Subject: [PATCH 2/4] fix: c# sbom generation with versionless packages Signed-off-by: BaseCrusher --- index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.js b/index.js index 89c1d1458..595fe0599 100644 --- a/index.js +++ b/index.js @@ -4109,6 +4109,9 @@ export const trimComponents = (components, format) => { const keyCache = {}; const filteredComponents = []; for (const comp of components) { + if (!comp.version) + continue; + if (format === "xml" && comp.component) { const key = comp.component.purl || From 80d0cec40cac4f17e395490eb1efe0cf37430513 Mon Sep 17 00:00:00 2001 From: BaseCrusher Date: Thu, 5 Oct 2023 11:36:26 +0200 Subject: [PATCH 3/4] chore: fixed linting Signed-off-by: BaseCrusher --- index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/index.js b/index.js index 595fe0599..e8f8303bb 100644 --- a/index.js +++ b/index.js @@ -4109,8 +4109,7 @@ export const trimComponents = (components, format) => { const keyCache = {}; const filteredComponents = []; for (const comp of components) { - if (!comp.version) - continue; + if (!comp.version) continue; if (format === "xml" && comp.component) { const key = From bf2d52cfad493265c42a6db58dd8d1cae4ee77fc Mon Sep 17 00:00:00 2001 From: BaseCrusher Date: Thu, 5 Oct 2023 13:28:34 +0200 Subject: [PATCH 4/4] revert: c# sbom generation with versionless packages Signed-off-by: BaseCrusher --- index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/index.js b/index.js index e8f8303bb..89c1d1458 100644 --- a/index.js +++ b/index.js @@ -4109,8 +4109,6 @@ export const trimComponents = (components, format) => { const keyCache = {}; const filteredComponents = []; for (const comp of components) { - if (!comp.version) continue; - if (format === "xml" && comp.component) { const key = comp.component.purl ||