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
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:
1 parent
d960ba658e
commit
8b58d14ca9
9 files changed
+886
-57
No files matched your search
+14
-3
@@ -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:
|
||||
|
||||
|
||||
+16
-3
@@ -63,9 +63,22 @@ die Abfrage für eine Installation ab.
|
||||
|
||||
**Unvollständig aufgelöste Abhängigkeiten.** Ein Projekt mit
|
||||
`<PackageReference>` ohne `packages.lock.json` und ohne
|
||||
`obj/project.assets.json` nennt nur seine direkten Pakete. Die Prüfung führt
|
||||
es unter **Nicht ausgeführt** (`sbom_dependencies`), und die SBOM-Anforderungen
|
||||
der CRA-Ansicht sind **Nicht bewertet**, bis eine Lockdatei vorliegt.
|
||||
`obj/project.assets.json` nennt nur seine direkten Pakete. Prüfwerk löst die
|
||||
transitiven dann aus den Paket-Metadaten von nuget.org auf, nach den Regeln
|
||||
von NuGet selbst (eine direkte Referenz legt ihre Version fest, eine
|
||||
Abhängigkeit nimmt die niedrigste Version, die ihr Bereich zulässt, und es gilt
|
||||
die Abhängigkeitsgruppe, die zum Zielframework des Projekts am besten passt).
|
||||
Es läuft kein `dotnet restore`: Es würde die MSBuild-Dateien des Repositorys
|
||||
auswerten, die Code ausführen können. Gesendet werden nur Paket-IDs und
|
||||
Versionen, keine, die `nuget.config` einem anderen Feed zuordnet. Diese Pakete
|
||||
erscheinen in der SBOM mit dem Nachweis „transitive, nuget.org“. Ein Projekt,
|
||||
dessen Abhängigkeiten nicht vollständig aufgelöst werden konnten (ein Paket
|
||||
aus einem anderen Feed, eine fehlgeschlagene Abfrage, ein Versionsbereich ohne
|
||||
Untergrenze), bleibt unter **Nicht ausgeführt** (`sbom_dependencies`) aufgeführt,
|
||||
alle solchen Projekte in einem Eintrag, und die SBOM-Anforderungen der
|
||||
CRA-Ansicht sind **Nicht bewertet**, bis eine Lockdatei vorliegt.
|
||||
`NUGET_TRANSITIVE_RESOLVE` schaltet die Auflösung (standardmäßig an, in
|
||||
Produktion bis zur Freigabe dort aus).
|
||||
|
||||
**Empfehlung:** Lockdateien einschalten und einchecken:
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user