Skip to content

Enable NuGet transitive dependency auditing (NuGetAuditMode=all)#1255

Draft
NickJosevski wants to merge 1 commit into
mainfrom
nickj/enable-nuget-audit
Draft

Enable NuGet transitive dependency auditing (NuGetAuditMode=all)#1255
NickJosevski wants to merge 1 commit into
mainfrom
nickj/enable-nuget-audit

Conversation

@NickJosevski

Copy link
Copy Markdown
Contributor

Background

While remediating the transitive System.Security.Cryptography.Xml 8.0.2 CVEs (found by an image scan, fixed in a separate PR), it became clear that nothing in the build flags vulnerable transitive packages. The .NET 8 SDK enables NuGet auditing by default, but only in direct mode — it audits direct PackageReferences and ignores the transitive graph, which is where these CVEs lived.

This PR turns on NuGetAuditMode=all so dotnet restore audits the full dependency graph and emits NU1901NU1904 warnings for known-vulnerable packages.

Results

Added to source/Octopus.Tentacle/Octopus.Tentacle.csproj:

<PropertyGroup>
  <NuGetAudit>true</NuGetAudit>
  <NuGetAuditMode>all</NuGetAuditMode>
  <NuGetAuditLevel>low</NuGetAuditLevel>
  <WarningsNotAsErrors>$(WarningsNotAsErrors);NU1901;NU1902;NU1903;NU1904</WarningsNotAsErrors>
</PropertyGroup>

A fresh dotnet restore (net8.0) now reports — and notably surfaces 5 vulnerable transitive packages, not just the one we went looking for:

Package Severity
System.Security.Cryptography.Xml 8.0.2 high ×2 (the CVEs we're fixing)
System.Net.Http 4.1.0 high
System.Private.Uri 4.3.0 high ×2 + moderate
System.Security.Cryptography.X509Certificates 4.1.0 high
System.Text.RegularExpressions 4.3.0 high

(The 4.x findings are exactly the packages PR #1205 set out to pin — this is independent confirmation of that work.)

Important: this does NOT break the build

The project sets TreatWarningsAsErrors, so audit findings would otherwise become errors and fail CI. WarningsNotAsErrors keeps NU190x as warnings — informational visibility, not a hard gate. Verified: dotnet restore exits 0 with the warnings printed.

How to review this PR

Quality ✔️ — single <PropertyGroup>. To see it work: dotnet restore source/Octopus.Tentacle/Octopus.Tentacle.csproj -p:TargetFramework=net8.0 --force and watch the NU1903 warnings. If you later want this to be a gate, drop the WarningsNotAsErrors line (or scope it) so findings fail the build.

The .NET 8 SDK audits only DIRECT PackageReferences by default
(NuGetAuditMode=direct), so transitively-resolved vulnerable packages -
such as System.Security.Cryptography.Xml 8.0.2 - are invisible at build
time. Setting NuGetAuditMode=all audits the full dependency graph and
emits NU1901-NU1904 restore warnings for known-vulnerable packages.

Findings are kept as warnings (WarningsNotAsErrors) so they surface
without tripping the project's TreatWarningsAsErrors and breaking the
build - this is informational, not a hard gate.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@NickJosevski NickJosevski requested a review from a team as a code owner June 18, 2026 04:27
@NickJosevski NickJosevski marked this pull request as draft June 18, 2026 07:10

@todthomson todthomson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, with thanks. 🥇

re: WarningsNotAsErrors
I am not opposed to you just failing the build for CVEs, thought that's just my opinion, but you could ask in EFT Requests in Slack if you agree. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants