feat(sbom): transitive NuGet packages resolved from nuget.org metadata (#461)
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 8m6s

Closes #461. SDK-style projects without packages.lock.json or
obj/project.assets.json named only their direct packages, and each was
its own "Nicht ausgeführt" entry.

- sbom/nuget_resolve.rs resolves the transitive graph from nuget.org's
  catalog entries (dependencyGroups per target framework) with NuGet's
  rules: a direct reference fixes its version, a dependency takes its
  range's lower bound, the highest of several; the dependency group
  nearest the project's framework applies (.NET Framework, .NET/.NET
  Core, .NET Standard incl. the Framework→Standard map, framework-free).
  Frameworks from TargetFramework(s) or TargetFrameworkVersion.
- No dotnet restore: it evaluates the repository's MSBuild files, which
  can run code. Requests go through the guarded nuget.org registry of
  #467 (shared catalog() fetch), honour nuget.config/packageSourceMapping
  (an id routed to another feed is never asked about, direct ones
  included), and are capped (400 lookups, 90 s per scan).
- A project counts as resolved only when every package of its graph was
  answered; the rest stay a gap, now ONE sbom_dependencies entry naming
  all such projects ("A.csproj, B.csproj and N more"). What was found is
  in the SBOM either way, with evidence "<project> (transitive,
  nuget.org)"; licences are filled by the existing lookup.
- packages.config projects need nothing: the file lists every installed
  package, transitive ones included.
- Switch NUGET_TRANSITIVE_RESOLVE: on by default, off with
  APP_ENV=production until tested on stage.
- Tests: fake nuget.org (framework group choice, lowest applicable,
  direct pin, missing package, private feed), framework/range parsing,
  the aggregated gap; an ignored test against the real nuget.org
  (Serilog.Sinks.File 5.0.0 on net48 → Serilog 2.10.0) passes.
- Docs (dotnet DE/EN); staging test plan: check 16.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
This commit is contained in:
Sharang ParnerkarandClaude Opus 5.5 committed 2026-10-06 10:58:32 +02:00
1 parent d960ba658e
commit 8b58d14ca9
9 files changed
+886 -57

No files matched your search

+14 -3
View File
@@ -61,9 +61,20 @@ deployment.
**Dependencies not fully resolved.** A project with `<PackageReference>` items
and neither `packages.lock.json` nor `obj/project.assets.json` names only its
direct packages. The scan lists it under **Nicht ausgeführt**
(`sbom_dependencies`), and the SBOM requirements of the CRA view stay **Nicht
bewertet** until a lockfile is committed.
direct packages. Prüfwerk then resolves the transitive ones from nuget.org's
package metadata, the way NuGet itself does (a direct reference fixes its
version; a dependency takes the lowest version its range admits; the
dependency group nearest the project's target framework applies). No
`dotnet restore` runs: it would evaluate the repository's MSBuild files,
which can run code. Only package ids and versions are sent, and none that
`nuget.config` routes to another feed. These packages appear in the SBOM with
the evidence "transitive, nuget.org". A project whose graph could not be
resolved completely (a package on another feed, a lookup that failed, a
version range without a lower bound) stays listed under **Nicht ausgeführt**
(`sbom_dependencies`), all such projects in one entry, and the SBOM
requirements of the CRA view stay **Nicht bewertet** until a lockfile is
committed. `NUGET_TRANSITIVE_RESOLVE` switches the resolution (on by default,
off in production until released there).
**Recommendation:** switch lockfiles on and commit them: