Skip to content

Don't fail CI builds on NuGet audit advisories#391

Merged
oschwald merged 1 commit intomainfrom
wstorey/suppress-ci
Apr 24, 2026
Merged

Don't fail CI builds on NuGet audit advisories#391
oschwald merged 1 commit intomainfrom
wstorey/suppress-ci

Conversation

@horgh
Copy link
Copy Markdown
Contributor

@horgh horgh commented Apr 24, 2026

Summary

  • Add a CI-only WarningsNotAsErrors entry for NU1901-NU1904 in the unit-test csproj, so NuGet audit advisories on dependencies don't red-X every build while we wait for a Dependabot upgrade.
  • TreatWarningsAsErrors stays on, and local builds remain strict — the condition is keyed on the CI=true env var that GitHub Actions sets automatically. Advisories still appear in CI build output.

Companion change in GeoIP2-dotnet and MaxMind-DB-Reader-dotnet.

Test plan

  • CI passes on this branch
  • Introduce a known-vulnerable package locally (without CI=true) to confirm the build still fails locally

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the unit test project configuration to treat NuGet audit advisories (NU1901-NU1904) as warnings rather than errors when running in CI environments. The review feedback recommends applying this setting globally or to the main library project for consistency, using additive syntax to avoid overwriting existing properties, and including NU1905 to cover retired packages.

<!-- In CI, don't fail the build on NuGet audit advisories (NU1901-NU1904).
Advisories still appear in build output, and Dependabot handles the
actual fix. Local builds keep the strict behavior. -->
<WarningsNotAsErrors Condition="'$(CI)' == 'true'">NU1901;NU1902;NU1903;NU1904</WarningsNotAsErrors>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This change only applies to the unit test project. However, the main library project MaxMind.MinFraud.csproj also has TreatWarningsAsErrors set to true (line 32). If a NuGet audit advisory is triggered by a dependency in the library project, the CI build will still fail during the compilation of that project. To fully achieve the goal of not failing CI builds on these advisories, you should apply this configuration to MaxMind.MinFraud.csproj as well, or consider using a Directory.Build.props file in the repository root to apply this setting globally across the repository. Additionally, it is a best practice to use the additive syntax $(WarningsNotAsErrors);... to avoid overwriting any values that might be set in imported property files. Finally, since this project targets .NET 9 and .NET 10, you may also want to include NU1905 (Package is retired) in the list.

    <WarningsNotAsErrors Condition="'$(CI)' == 'true'">$(WarningsNotAsErrors);NU1901;NU1902;NU1903;NU1904</WarningsNotAsErrors>

Set WarningsNotAsErrors for NU1901-NU1904 when building in CI (CI=true).
This keeps TreatWarningsAsErrors strict locally so developers still
catch issues, but avoids every PR being blocked by a newly-published
advisory on a dependency until Dependabot can merge an upgrade. The
advisory still appears in the build output for visibility.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@horgh horgh force-pushed the wstorey/suppress-ci branch from 3368599 to a7ff8d9 Compare April 24, 2026 17:42
@oschwald oschwald merged commit daa324e into main Apr 24, 2026
16 checks passed
@oschwald oschwald deleted the wstorey/suppress-ci branch April 24, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants