Repository navigation
Description
Problem
OSV-Scanner gives zero transitive NuGet coverage for SDK-style projects that use only <PackageReference> with no committed lock file. OSV-Scanner parses only packages.lock.json, *.deps.json, and packages.config — it never reads .csproj <PackageReference> and has no restore/resolution engine. So a PackageReference-only repo scans nothing for the NuGet ecosystem, and --allow-no-lockfiles (used by consumers, e.g. github-iac) just turns the erroring scan into a green-but-empty one — strictly worse, because it hides the gap.
Surfaced by a code review of github-iac (the one known transitive vuln there, OpenTelemetry 1.9.0, is only caught because it's manually pinned — OSV-Scanner itself sees nothing).
Proposal (build posture → belongs in the standards .NET overlay)
Add to the .NET overlay (the modules/dotnet Directory.Build.props that consumers import):
<PropertyGroup>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>Consumers then commit the generated packages.lock.json (the only OSV-supported .NET input that is committable and carries the full transitive closure). This also makes restore reproducible.
Caveats to design for
- CI locked-mode (
RestoreLockedMode=true/dotnet restore --locked-mode) for repeatable builds — fails (NU1004) if the resolved graph drifts from the lock file. Belongs in the ci-workflows restore step (see linked issue). - SDK sensitivity — implicit framework deps vary across SDK versions; pin via
global.json+rollForward: disableto avoid locked-restore breakage. - Dependabot — supports updating
packages.lock.jsonfor directPackageReferencebumps but has open gaps (CPM / transitive-via-ProjectReference); consumers may need adotnet restore --force-evaluatestep on Dependabot PRs. Coordinated in the linked ci-workflows issue.
Sources
- OSV-Scanner supported lockfiles: https://google.github.io/osv-scanner/supported-languages-and-lockfiles/
- NuGet lock files: https://learn.microsoft.com/nuget/consume-packages/package-references-in-project-files#locking-dependencies
- Locked restore in CI: https://learn.microsoft.com/azure/devops/pipelines/artifacts/caching-nuget
Companion: ci-workflows issue (locked-mode restore + OSV coverage + Dependabot lock regen).
Activity
feat(dotnet): enable NuGet lock files in the overlay (#59)
feat: real transitive NuGet coverage for the OSV-Scanner lane (#54)
docs(issue-tracker): codify closing-keyword, title, and comment house…