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

@@ -16,6 +16,7 @@ together on stage in one pass before the next prod promotion.
| #484 | Groups take over their places' decisions (#483) |
| #486 | The clone cache heals itself after an interrupted clone or fetch |
| #465 | Malware stage (ClamAV), committed binaries, unchanged scheduled rescans skipped |
| #461 | Transitive NuGet packages of `<PackageReference>` projects resolved from nuget.org |
**Customer-visible on the next prod rescan** is marked **[visible]**: these
change what a customer sees on their existing targets, without them doing
@@ -267,6 +268,26 @@ Unchanged rescans:
- **[visible]** scheduled scans of unchanged targets no longer count as scans
(usage), and a new Prüfwerk release rescans every target once.
### 16. #461 Transitive NuGet packages
- **Do:** upload a tree with an SDK-style project, no `packages.lock.json` and
no `obj/`, e.g. `App/App.csproj` targeting `net48` with
`<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />`; and a
second project that references a package only a private feed has, with a
`nuget.config` mapping that id to the private feed.
- **Expect:** the SBOM lists `Serilog 2.10.0` (`pkg:nuget/Serilog@2.10.0`)
with the evidence `App/App.csproj (transitive, nuget.org)`, licence filled.
**Nicht ausgeführt** has **one** `sbom_dependencies` entry naming only the
second project (all unresolved projects in one entry, not one per project).
A project with a `packages.lock.json` is unaffected.
- **Log:** `transitive NuGet packages resolved from nuget.org` with
`projects`, `resolved`, `packages`, `lookups`.
- **Switch:** stage runs it by default (`APP_ENV=staging`); prod stays off
until `NUGET_TRANSITIVE_RESOLVE=true` is set there.
- **[visible]** after it is switched on in prod: .NET targets gain their
transitive packages (and their CVEs) in the SBOM, and the "Nicht
ausgeführt" list shrinks to one entry. On stage now.
## After the pass
- The nightly job on `main` is green with the new mobile targets.