Skip to content

Commit 59f00f7

Browse files
authored
fix: analysis of an empty manifest returns non-zero scanned deps (guacsec#422)
fix: analysis of an empty go manifest returns non-zero scanned depenedencies
1 parent 608d6fa commit 59f00f7

90 files changed

Lines changed: 9791 additions & 9749 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/cyclone_dx_sbom.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ export default class CycloneDxSbom {
149149
getAsJsonString(opts) {
150150
let manifestType = opts["manifest-type"]
151151
this.setSourceManifest(opts["source-manifest"])
152+
const rootPurl = this.rootComponent?.purl;
152153
this.sbomObject = {
153154
"bomFormat": "CycloneDX",
154155
"specVersion": "1.4",
@@ -158,7 +159,7 @@ export default class CycloneDxSbom {
158159
"component": this.rootComponent,
159160
"properties": new Array()
160161
},
161-
"components": this.components,
162+
"components": this.components.filter(c => c.purl !== rootPurl),
162163
"dependencies": this.dependencies
163164
}
164165
if (this.rootComponent === undefined)

test/providers/tst_manifests/cargo/cargo_single_crate_no_ignore/expected_sbom_component_analysis.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@
1313
}
1414
},
1515
"components": [
16-
{
17-
"name": "my-test-crate",
18-
"version": "0.1.0",
19-
"purl": "pkg:cargo/my-test-crate@0.1.0",
20-
"type": "application",
21-
"bom-ref": "pkg:cargo/my-test-crate@0.1.0"
22-
},
2316
{
2417
"name": "serde",
2518
"version": "1.0.193",

test/providers/tst_manifests/cargo/cargo_single_crate_no_ignore/expected_sbom_stack_analysis.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@
1313
}
1414
},
1515
"components": [
16-
{
17-
"name": "my-test-crate",
18-
"version": "0.1.0",
19-
"purl": "pkg:cargo/my-test-crate@0.1.0",
20-
"type": "application",
21-
"bom-ref": "pkg:cargo/my-test-crate@0.1.0"
22-
},
2316
{
2417
"name": "serde",
2518
"version": "1.0.193",

test/providers/tst_manifests/cargo/cargo_single_crate_with_exhortignore/expected_sbom_component_analysis.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@
1313
}
1414
},
1515
"components": [
16-
{
17-
"name": "my-test-crate",
18-
"version": "0.1.0",
19-
"purl": "pkg:cargo/my-test-crate@0.1.0",
20-
"type": "application",
21-
"bom-ref": "pkg:cargo/my-test-crate@0.1.0"
22-
},
2316
{
2417
"name": "tokio",
2518
"version": "1.35.0",

test/providers/tst_manifests/cargo/cargo_single_crate_with_exhortignore/expected_sbom_stack_analysis.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@
1313
}
1414
},
1515
"components": [
16-
{
17-
"name": "my-test-crate",
18-
"version": "0.1.0",
19-
"purl": "pkg:cargo/my-test-crate@0.1.0",
20-
"type": "application",
21-
"bom-ref": "pkg:cargo/my-test-crate@0.1.0"
22-
},
2316
{
2417
"name": "tokio",
2518
"version": "1.35.0",

test/providers/tst_manifests/cargo/cargo_single_crate_with_ignore/expected_sbom_component_analysis.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@
1313
}
1414
},
1515
"components": [
16-
{
17-
"name": "my-test-crate",
18-
"version": "0.1.0",
19-
"purl": "pkg:cargo/my-test-crate@0.1.0",
20-
"type": "application",
21-
"bom-ref": "pkg:cargo/my-test-crate@0.1.0"
22-
},
2316
{
2417
"name": "tokio",
2518
"version": "1.35.0",

test/providers/tst_manifests/cargo/cargo_single_crate_with_ignore/expected_sbom_stack_analysis.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@
1313
}
1414
},
1515
"components": [
16-
{
17-
"name": "my-test-crate",
18-
"version": "0.1.0",
19-
"purl": "pkg:cargo/my-test-crate@0.1.0",
20-
"type": "application",
21-
"bom-ref": "pkg:cargo/my-test-crate@0.1.0"
22-
},
2316
{
2417
"name": "tokio",
2518
"version": "1.35.0",

test/providers/tst_manifests/cargo/cargo_single_crate_with_license/expected_sbom_component_analysis.json

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,6 @@
2020
}
2121
},
2222
"components": [
23-
{
24-
"name": "my-test-crate",
25-
"version": "0.1.0",
26-
"purl": "pkg:cargo/my-test-crate@0.1.0",
27-
"type": "application",
28-
"bom-ref": "pkg:cargo/my-test-crate@0.1.0",
29-
"licenses": [
30-
{
31-
"license": {
32-
"id": "ISC"
33-
}
34-
}
35-
]
36-
},
3723
{
3824
"name": "serde",
3925
"version": "1.0.193",

test/providers/tst_manifests/cargo/cargo_single_crate_with_license/expected_sbom_stack_analysis.json

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,6 @@
2020
}
2121
},
2222
"components": [
23-
{
24-
"name": "my-test-crate",
25-
"version": "0.1.0",
26-
"purl": "pkg:cargo/my-test-crate@0.1.0",
27-
"type": "application",
28-
"bom-ref": "pkg:cargo/my-test-crate@0.1.0",
29-
"licenses": [
30-
{
31-
"license": {
32-
"id": "ISC"
33-
}
34-
}
35-
]
36-
},
3723
{
3824
"name": "serde",
3925
"version": "1.0.193",

test/providers/tst_manifests/cargo/cargo_virtual_workspace/expected_sbom_component_analysis.json

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@
1212
"bom-ref": "pkg:cargo/cargo_virtual_workspace@0.0.0"
1313
}
1414
},
15-
"components": [
16-
{
17-
"name": "cargo_virtual_workspace",
18-
"version": "0.0.0",
19-
"purl": "pkg:cargo/cargo_virtual_workspace@0.0.0",
20-
"type": "application",
21-
"bom-ref": "pkg:cargo/cargo_virtual_workspace@0.0.0"
22-
}
23-
],
15+
"components": [],
2416
"dependencies": []
2517
}

0 commit comments

Comments
 (0)