fix(sbom): .NET assemblies from DLL metadata mapped to NuGet ids (#460)
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 10m42s

Syft names a DLL without a .deps.json by its version resource: product
name and file version. As a purl that is no NuGet package, so OSV
matched nothing: pkg:nuget/DotNetZip%20Library@1.9.1.5 has no advisory,
pkg:nuget/DotNetZip@1.9.1.5 has GHSA-7378-6268-4278.

Syft's dotnet-portable-executable-entry components are now mapped, in
this order:

- a DLL inside packages/<Id>.<Version>/ is that package
- a curated alias table, by assembly name (file name) and then product
  name (DotNetZip Library -> DotNetZip, Json.NET -> Newtonsoft.Json,
  Apache log4net -> log4net, Xceed Toolkit for WPF ->
  Extended.Wpf.Toolkit, empira MigraDoc -> PDFsharp-MigraDoc), with how
  the package's file versions relate to its versions (Newtonsoft.Json:
  first three parts; EntityFramework: unrelated, so the DLL only
  confirms a manifest entry)
- the assembly name, when it is a valid NuGet id and not one of the
  tree's own projects (project name or <AssemblyName>), whose names are
  not sent to OSV or nuget.org
- otherwise no purl, and the scan records the assembly as not matched
  against OSV

Alias before file name: DotNetZip ships Ionic.Zip.dll, and Ionic.Zip is
a different package. Versions go through nuget_license's
normalise_version (4.1.0.0 -> 4.1.0, +build dropped); a non-zero fourth
part stays (1.9.1.5 is a real NuGet version).

One package found in several DLLs, or in a DLL and a manifest, is one
entry: SbomEntry gains `evidence` (the manifests and DLLs it was read
from), and merge_nuget compares normalised versions and merges the
evidence instead of dropping it. Native pe-binary components are left
as they are.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
This commit is contained in:
Sharang ParnerkarandClaude Opus 5.5 committed 2026-10-06 00:23:10 +02:00
1 parent 34688fa322
commit 8571b660a2
9 files changed
+801 -46

No files matched your search

+14
View File
@@ -32,6 +32,20 @@ Every package with an exact version gets the purl `pkg:nuget/<Id>@<Version>`
and is matched against OSV (ecosystem NuGet). A version range (`7.*`,
`[1.0,2.0)`) is listed without a purl, with the range as its requirement.
**Packages from DLLs.** Syft also reads DLLs (in `bin/`, `lib/`, committed
anywhere) and names them by their version resource: product name and file
version (`DotNetZip Library 1.9.1.5`, `Json.NET 13.0.1.25517`). Those are
mapped to the NuGet package: a DLL inside `packages/<Id>.<Version>/` is that
package; known product and assembly names map through a curated table
(`DotNetZip Library` → `DotNetZip`, `Json.NET` → `Newtonsoft.Json`, …);
otherwise the assembly name (file name) is the id. Versions are normalised as
NuGet files them (`4.1.0.0` → `4.1.0`, `+build` metadata dropped). The DLLs
of the tree's own projects (project name or `<AssemblyName>`) get no purl. A
DLL that cannot be mapped stays in the SBOM without a purl and is listed in
the scan as not matched against OSV. One package found in several places
(manifest and DLL, several DLLs) is one SBOM entry, with every place as
evidence.
**Licenses of NuGet packages.** First from the `.nuspec` of a restored package
(`packages/<Id>.<Version>/`): `<license type="expression">` as an SPDX
expression, `<license type="file">` as `LicenseRef-file`, an older
+14
View File
@@ -33,6 +33,20 @@ wird gegen OSV (Ökosystem NuGet) abgeglichen. Ein Versionsbereich (`7.*`,
`[1.0,2.0)`) steht ohne purl in der Stückliste, mit dem Bereich als
Anforderung.
**Pakete aus DLLs.** Syft liest auch DLLs (in `bin/`, `lib/`, irgendwo
eingecheckt) und benennt sie nach ihrer Versionsressource: Produktname und
Dateiversion (`DotNetZip Library 1.9.1.5`, `Json.NET 13.0.1.25517`). Diese
werden dem NuGet-Paket zugeordnet: eine DLL in `packages/<Id>.<Version>/` ist
dieses Paket; bekannte Produkt- und Assembly-Namen über eine gepflegte Tabelle
(`DotNetZip Library` → `DotNetZip`, `Json.NET` → `Newtonsoft.Json`, …); sonst
ist der Assembly-Name (Dateiname) die Id. Versionen werden normalisiert, wie
NuGet sie führt (`4.1.0.0` → `4.1.0`, `+build`-Metadaten entfallen). DLLs der
eigenen Projekte (Projektname oder `<AssemblyName>`) erhalten keine purl. Eine
DLL ohne Zuordnung bleibt ohne purl in der Stückliste und wird im Scan als
nicht gegen OSV abgeglichen ausgewiesen. Ein Paket, das an mehreren Stellen
vorkommt (Manifest und DLL, mehrere DLLs), ist ein Eintrag mit allen
Fundstellen als Nachweis.
**Lizenzen der NuGet-Pakete.** Zuerst aus der `.nuspec` eines
wiederhergestellten Pakets (`packages/<Id>.<Version>/`): `<license
type="expression">` als SPDX-Ausdruck, `<license type="file">` als