diff --git a/providers/os/resources/purl/platform_purl.go b/providers/os/resources/purl/platform_purl.go index dc93227cda..d4f04a6faf 100644 --- a/providers/os/resources/purl/platform_purl.go +++ b/providers/os/resources/purl/platform_purl.go @@ -32,7 +32,7 @@ func NewPlatformPurl(platform *inventory.Platform) (string, error) { qualifiers[QualifierDistro] = strings.Join(distroQualifiers, "-") return packageurl.NewPackageURL( - "platform", + string(Type_X_Platform), platform.Name, "", platform.Version, diff --git a/providers/os/resources/purl/purl_types.go b/providers/os/resources/purl/purl_types.go index 3b5707c3bf..36d8741661 100644 --- a/providers/os/resources/purl/purl_types.go +++ b/providers/os/resources/purl/purl_types.go @@ -17,7 +17,8 @@ var ( TypeAppx Type = "appx" // TypeMacos is a pkg:macos purl. TypeMacos Type = "macos" - + // Type_X_Platform is a pkg:platform purl. + Type_X_Platform Type = "platform" // Types we use coming from: // https://github.com/package-url/packageurl-go/blob/master/packageurl.go#L54 TypeGeneric = Type(packageurl.TypeGeneric) @@ -27,14 +28,15 @@ var ( TypeRPM = Type(packageurl.TypeRPM) KnownTypes = map[Type]struct{}{ - TypeAppx: {}, - TypeWindows: {}, - TypeMacos: {}, - TypeGeneric: {}, - TypeApk: {}, - TypeDebian: {}, - TypeAlpm: {}, - TypeRPM: {}, + TypeAppx: {}, + TypeWindows: {}, + TypeMacos: {}, + Type_X_Platform: {}, + TypeGeneric: {}, + TypeApk: {}, + TypeDebian: {}, + TypeAlpm: {}, + TypeRPM: {}, } ) diff --git a/providers/os/resources/purl/purl_types_test.go b/providers/os/resources/purl/purl_types_test.go index ba329b7c7e..b237a85214 100644 --- a/providers/os/resources/purl/purl_types_test.go +++ b/providers/os/resources/purl/purl_types_test.go @@ -16,6 +16,7 @@ func TestValidType(t *testing.T) { validTypes := []purl.Type{ purl.TypeWindows, purl.TypeAppx, purl.TypeMacos, purl.TypeGeneric, purl.TypeApk, purl.TypeDebian, purl.TypeAlpm, purl.TypeRPM, + purl.Type_X_Platform, } for _, validType := range validTypes { @@ -48,6 +49,7 @@ func TestValidTypeString(t *testing.T) { string(purl.TypeWindows), string(purl.TypeAppx), string(purl.TypeMacos), packageurl.TypeGeneric, packageurl.TypeApk, packageurl.TypeDebian, packageurl.TypeAlpm, packageurl.TypeRPM, "windows", "appx", "macos", + "platform", string(purl.Type_X_Platform), } for _, validType := range validTypes {