Skip to content

Commit 3591365

Browse files
authored
fix: output invalid PURLs when scanning sboms (google#1283)
While I believe such situations indicate a bug in the tool used to generate the SBOM, outputting the PURLs should make it easier to debug the issue. Resolves google#86
1 parent 866b3e0 commit 3591365

File tree

4 files changed

+613
-6
lines changed

4 files changed

+613
-6
lines changed

cmd/osv-scanner/__snapshots__/main_test.snap

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,12 @@ Scanned <rootdir>/fixtures/locks-insecure/composer.lock file and found 1 package
540540
[TestRun/folder_of_supported_sbom_with_vulns - 1]
541541
Scanning dir ./fixtures/sbom-insecure/
542542
Scanned <rootdir>/fixtures/sbom-insecure/alpine.cdx.xml as CycloneDX SBOM and found 14 packages
543+
Scanned <rootdir>/fixtures/sbom-insecure/bad-purls.cdx.xml as CycloneDX SBOM and found 8 packages
544+
Ignored 6 packages with invalid PURLs
545+
Ignored invalid PURL "/"
546+
Ignored invalid PURL "pkg:///"
547+
Ignored invalid PURL "pkg:apk/alpine/@1.36.1-r27?arch=x86_64&upstream=busybox&distro=alpine-3.17.2"
548+
Ignored invalid PURL "pkg:pypi/"
543549
Scanned <rootdir>/fixtures/sbom-insecure/postgres-stretch.cdx.xml as CycloneDX SBOM and found 136 packages
544550
+-------------------------------------+------+-----------+--------------------------------+------------------------------------+-------------------------------------------------+
545551
| OSV URL | CVSS | ECOSYSTEM | PACKAGE | VERSION | SOURCE |
@@ -688,6 +694,21 @@ No issues found
688694

689695
---
690696

697+
[TestRun/one_specific_supported_sbom_with_invalid_PURLs - 1]
698+
Scanned <rootdir>/fixtures/sbom-insecure/bad-purls.cdx.xml as CycloneDX SBOM and found 8 packages
699+
Ignored 6 packages with invalid PURLs
700+
Ignored invalid PURL "/"
701+
Ignored invalid PURL "pkg:///"
702+
Ignored invalid PURL "pkg:apk/alpine/@1.36.1-r27?arch=x86_64&upstream=busybox&distro=alpine-3.17.2"
703+
Ignored invalid PURL "pkg:pypi/"
704+
No issues found
705+
706+
---
707+
708+
[TestRun/one_specific_supported_sbom_with_invalid_PURLs - 2]
709+
710+
---
711+
691712
[TestRun/one_specific_supported_sbom_with_vulns - 1]
692713
Scanned <rootdir>/fixtures/sbom-insecure/alpine.cdx.xml as CycloneDX SBOM and found 14 packages
693714
+--------------------------------+------+-----------+---------+-----------+---------------------------------------+

0 commit comments

Comments
 (0)