Skip to content

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

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

Don't fail CI builds on NuGet audit advisories#286
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 minfraud-api-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 MaxMind.Db.Test.csproj file to ensure that NuGet audit advisories (NU1901-NU1904) do not cause build failures in CI environments. The review feedback recommends centralizing this configuration in a Directory.Build.props file to maintain consistency across the repository, appending to the WarningsNotAsErrors property instead of overwriting it, and adding NU1905 to cover all advisory severities.

Comment thread MaxMind.Db.Test/MaxMind.Db.Test.csproj Outdated
<!-- 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

To improve maintainability and ensure consistency across the repository, consider moving this configuration to a Directory.Build.props file at the root. This would automatically apply the rule to all projects, including MaxMind.Db.csproj (which also has TreatWarningsAsErrors enabled), and avoid duplication.

Additionally, it is a best practice to append to the WarningsNotAsErrors property rather than overwriting it, to avoid conflicts with values that might be set in other property groups or imported files. You might also consider adding NU1905 to cover 'Unknown' severity advisories.

    <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 88edefa to 5cf53ea Compare April 24, 2026 17:41
@oschwald oschwald merged commit c3ed8ac 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