Configure NuGet audit sources and non-fatal vulnerability warnings - #20052
Configure NuGet audit sources and non-fatal vulnerability warnings#20052Jose Perez Rodriguez (joperezr) wants to merge 1 commit into
Conversation
Use data.nuget.org for vulnerability metadata without changing package feeds. Add the audit warning exemption missing from Arcade 10, with cleanup after upgrading to Arcade 11. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3b559861-b2bb-4130-9adc-0ebe3542e70a
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 20052Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 20052" |
Tests selectorSelects the full PR test matrix + all PR-gated jobs (ALL) — a rule matching 'Directory.Build.props' selects ALL Advisory workflow impact (4)
Selection computed for commit |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The new audit source and conditional warning policy need automated regression coverage.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 2
New issues introduced by this change (2)
| Severity | Finding |
|---|---|
Directory.Build.props — Automate the warning-policy validation |
|
NuGet.config — Add regression coverage for the audit source |
What changed in this PR
Configures NuGet vulnerability auditing without enabling public package downloads.
Changes:
- Adds the vulnerability-only NuGet audit source.
- Keeps NU1901–NU1904 visible but non-fatal unless explicitly opted in.
| File | Description |
|---|---|
NuGet.config |
Configures the audit-only NuGet endpoint. |
Directory.Build.props |
Exempts audit findings from warnings-as-errors. |
| <TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
| <!-- Keep NuGet Audit warnings visible without failing developer/CI builds. | ||
| Remove after upgrading to Arcade 11, which supplies this exemption. --> | ||
| <WarningsNotAsErrors Condition="'$(TreatNuGetAuditWarningsAsErrors)' != 'true'">$(WarningsNotAsErrors);NU1901;NU1902;NU1903;NU1904</WarningsNotAsErrors> |
| </packageSources> | ||
| <auditSources> | ||
| <clear /> | ||
| <add key="nuget.org" value="https://data.nuget.org/v3/index.json" /> |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
|
Damian Edwards (@DamianEdwards) tagging you on this change: it adds data.nuget.org as an audit source and the NU1901–NU1904 warning exemption missing from our current Arcade version, with a comment to remove the exemption after upgrading to Arcade 11. |

Description
Use public NuGet vulnerability metadata during developer and CI restores without adding nuget.org as a package download source or changing the existing package-source mappings.
auditSourcessection toNuGet.config, clearing inherited audit sources and selectinghttps://data.nuget.org/v3/index.json.NU1901–NU1904toWarningsNotAsErrorswhile retainingTreatWarningsAsErrors=true, preserving existing exemptions, and respecting theTreatNuGetAuditWarningsAsErrors=trueopt-in.The pinned
Microsoft.DotNet.Arcade.Sdkversion,10.0.0-beta.26423.1, already setsNuGetAuditMode=alland disables auditing whenOfficialBuild=true, but does not include the vulnerability-warning exemption. No SDK update or duplicated audit-mode/official-build settings are needed. The exemption follows the newer Arcade policy. The existing official-build safeguard remains in place for dotnet/msbuild#10801.Validation
Infrastructure.Tests.NuGetConfigTestspassed (1 test).NuGetAudit=false.CS1591exemption is preserved.NU1901–NU1904.ALL.Security considerations
NuGet will retrieve public vulnerability metadata from
data.nuget.orgfor developer/CI restores. This is an audit-only source, not a package source; package downloads continue using the existing approved feeds. Vulnerability findings remain visible as warnings rather than being suppressed. Official-build auditing behavior is unchanged.Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?