From 2d85a003b22298d1101f84559f7c6b470f2b3909 Mon Sep 17 00:00:00 2001 From: DmitriyLewen <91113035+DmitriyLewen@users.noreply.github.com> Date: Wed, 19 Jun 2024 13:06:31 +0600 Subject: [PATCH] fix(purl): add missed os types (#6955) --- integration/testdata/mariner-1.0.json.golden | 4 ++-- pkg/purl/purl.go | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/integration/testdata/mariner-1.0.json.golden b/integration/testdata/mariner-1.0.json.golden index 1d549e1ef188..7325bf74f6e6 100644 --- a/integration/testdata/mariner-1.0.json.golden +++ b/integration/testdata/mariner-1.0.json.golden @@ -42,7 +42,7 @@ "VulnerabilityID": "CVE-2022-0261", "PkgName": "vim", "PkgIdentifier": { - "PURL": "pkg:cbl-mariner/vim@8.2.4081-1.cm1?arch=x86_64", + "PURL": "pkg:rpm/cbl-mariner/vim@8.2.4081-1.cm1?arch=x86_64\u0026distro=cbl-mariner-1.0.20220122", "UID": "3f08cd76fa5ba73d" }, "InstalledVersion": "8.2.4081-1.cm1", @@ -79,7 +79,7 @@ "VulnerabilityID": "CVE-2022-0158", "PkgName": "vim", "PkgIdentifier": { - "PURL": "pkg:cbl-mariner/vim@8.2.4081-1.cm1?arch=x86_64", + "PURL": "pkg:rpm/cbl-mariner/vim@8.2.4081-1.cm1?arch=x86_64\u0026distro=cbl-mariner-1.0.20220122", "UID": "3f08cd76fa5ba73d" }, "InstalledVersion": "8.2.4081-1.cm1", diff --git a/pkg/purl/purl.go b/pkg/purl/purl.go index 92ce07be9741..e312e40043f7 100644 --- a/pkg/purl/purl.go +++ b/pkg/purl/purl.go @@ -468,13 +468,14 @@ func purlType(t ftypes.TargetType) string { return packageurl.TypePub case ftypes.RustBinary, ftypes.Cargo: return packageurl.TypeCargo - case ftypes.Alpine: + case ftypes.Alpine, ftypes.Chainguard, ftypes.Wolfi: return packageurl.TypeApk case ftypes.Debian, ftypes.Ubuntu: return packageurl.TypeDebian case ftypes.RedHat, ftypes.CentOS, ftypes.Rocky, ftypes.Alma, ftypes.Amazon, ftypes.Fedora, ftypes.Oracle, ftypes.OpenSUSE, - ftypes.OpenSUSELeap, ftypes.OpenSUSETumbleweed, ftypes.SLES, ftypes.Photon: + ftypes.OpenSUSELeap, ftypes.OpenSUSETumbleweed, ftypes.SLES, ftypes.Photon, + ftypes.CBLMariner: return packageurl.TypeRPM case TypeOCI: return packageurl.TypeOCI