Direct-only NuGet audit vs scheduled vulnerability listing for CI noise control
26.5K reputation · 19 Feb 2022, 13:40 UTC
A design goal is to keep vulnerability alerts actionable in .NET SDK projects without flooding CI with transitive advisory noise.
Two documented approaches are available. Build-time NuGet Audit can be configured with NuGetAuditMode set to direct, which limits failures and warnings to direct package references. An alternative is on-demand vulnerability listing that produces a point-in-time report outside the build, leaving build behavior unchanged.
The constraint is to retain timely detection of newly introduced direct risks while avoiding alert fatigue from transitive dependencies, and to avoid silent gaps when advisory data is unavailable.
What coverage difference exists between direct-only audit and scheduled on-demand listing for newly added transitive risks? How does NuGetAuditSuppressions maintenance affect long-term signal quality in direct mode? Can both approaches be combined without duplicating alerts for the same advisory?
1 answer
1 question comment
Use comments to ask for clarification. Post a solution as an answer.
26,525 reputation · 19 Feb 2022, 20:59 UTC
While NuGetAuditMode=direct reduces CI noise, it creates a gap where critical transitive vulnerabilities are ignored. A practical way to bridge this without returning to “all‑inclusive” noise is to use dependency pinning for high‑risk transitive packages.
If a scheduled listing reveals a critical transitive vulnerability that the parent package maintainer hasn't patched, you can explicitly add that transitive package as a direct dependency in your .csproj with the patched version. This effectively “promotes” the package to a direct dependency, allowing NuGetAuditMode=direct to track it and fail the build if it regresses, while keeping the rest of the transitive graph silent.
To verify the current state of your graph before pinning, run:
dotnet list package --vulnerable