From 7c67df397e415076c51f1b4ce9dd4696f6ca5162 Mon Sep 17 00:00:00 2001 From: William Murphy Date: Wed, 3 Jan 2024 16:50:42 -0500 Subject: [PATCH] fix: PURLs with "nuget" type are dotnet packages (#2466) Otherwise, Grype won't match on well-formed .NET purls from other SBOM tools. Signed-off-by: Will Murphy --- syft/pkg/language.go | 2 +- syft/pkg/language_test.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/syft/pkg/language.go b/syft/pkg/language.go index 38760180e..889d31070 100644 --- a/syft/pkg/language.go +++ b/syft/pkg/language.go @@ -80,7 +80,7 @@ func LanguageByName(name string) Language { return Rust case packageurl.TypePub, string(DartPubPkg), string(Dart): return Dart - case packageurl.TypeDotnet: + case packageurl.TypeDotnet, packageurl.TypeNuget: return Dotnet case packageurl.TypeCocoapods, packageurl.TypeSwift, string(CocoapodsPkg), string(SwiftPkg): return Swift diff --git a/syft/pkg/language_test.go b/syft/pkg/language_test.go index 57417e280..147df0549 100644 --- a/syft/pkg/language_test.go +++ b/syft/pkg/language_test.go @@ -38,6 +38,10 @@ func TestLanguageFromPURL(t *testing.T) { purl: "pkg:dotnet/Microsoft.CodeAnalysis.Razor@2.2.0", want: Dotnet, }, + { + purl: "pkg:nuget/Newtonsoft.Json@13.0.0", + want: Dotnet, + }, { purl: "pkg:cargo/clap@2.33.0", want: Rust,