Skip to content

Configure NuGet audit sources and non-fatal vulnerability warnings - #20052

Merged
Jose Perez Rodriguez (joperezr) merged 3 commits into
mainfrom
joperezr-aspire-nuget-config
Sep 15, 2026
Merged

Jose Perez Rodriguez (joperezr) merged 3 commits into
mainfrom
joperezr-aspire-nuget-config

Conversation

@joperezr

@joperezr Jose Perez Rodriguez (joperezr) commented Sep 10, 2026 •

Copy link
Copy Markdown
Member

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.

  • Add auditSources to NuGet.config, clearing inherited audit sources and selecting https://data.nuget.org/v3/index.json.
  • Add NU1901–NU1904 to WarningsNotAsErrors, preserving inherited exemptions and respecting TreatNuGetAuditWarningsAsErrors=true. Remove this temporary assignment after upgrading to Arcade 11, which supplies it.
  • Evaluate the repository's WarningsNotAsErrors through eng/WarningPolicy.proj and forward the result through Arcade's -warnNotAsError option in both build entry points. Warning codes remain in one place rather than being duplicated in the scripts.
  • Preserve configuration, CI context, MSBuild properties, explicit additional exemptions, and the existing warnings-as-errors opt-out. Keep paths with spaces and semicolon-delimited warning lists intact, including through the public Bash build/restore wrappers.
  • Skip policy evaluation for -clean, preserving Arcade's SDK-free cleanup path.
  • Add regression coverage and route changes to the build entry points, public Bash wrappers, and evaluation project to ALL in the test-trigger map. Document the policy in the contributor guide.

Why forwarding is needed

The original change exposed existing vulnerable dependencies, but CI still failed: Arcade invokes a standalone NuGet.targets project under MSBuild's /warnaserror. That project does not import our Directory.Build.props, so a project-level WarningsNotAsErrors assignment alone cannot protect its logger. Evaluating and forwarding the policy applies the exemption at that outer command-line level while preserving unrelated warnings as errors. See also dotnet/msbuild#10801.

The pinned Arcade version, 10.0.0-beta.26423.1, already sets NuGetAuditMode=all and disables auditing when OfficialBuild=true; these settings remain unchanged. It lacks the vulnerability-warning exemption supplied by newer Arcade. The Arcade 11 cleanup comment refers to that temporary assignment, not to the generic forwarding mechanism.

Validation

  • 109 focused Infrastructure tests passed, covering effective repository policy, inherited exemptions, strict/official settings, both PowerShell and Bash entry points with real standalone MSBuild logging, configuration/property forwarding, additional exemptions, default actions, disabled warnings-as-errors, unrelated warning failures, empty policies, and failed policy evaluation.
  • Bash scenarios exercise the public build.sh and restore.sh wrappers, including arguments containing spaces and semicolon-delimited warning lists.
  • Clean scenarios verify that SDK bootstrap is not started and invalid policy XML is not evaluated, including clean combined with restore/build actions.
  • Exact audit-source shape and audit/package-source separation are covered, along with ALL test routing for the build-policy inputs and public Bash wrappers.
  • Actual build.cmd/Arcade restore of Aspire.Npgsql.Tests succeeds while retaining the SSH.NET NU1903 warning.
  • The same real restore with /p:TreatNuGetAuditWarningsAsErrors=true fails on that advisory as intended.
  • Full cross-platform CI will validate the new commit; local Bash coverage uses Git Bash with the repository SDK and isolated Arcade stubs.

Security considerations

Developer/CI restores retrieve public vulnerability metadata from data.nuget.org. Package downloads continue using the existing approved feeds. Findings remain visible, rather than being suppressed, and official-build auditing behavior is unchanged. Warning exemptions do not remediate the underlying vulnerable dependencies.

Fixes # (issue)

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

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 <[email protected]>
Copilot-Session: 3b559861-b2bb-4130-9adc-0ebe3542e70a
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 20052

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 20052"

@github-actions github-actions Bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Sep 10, 2026
@aspire-repo-bot
aspire-repo-bot Bot requested a balanced review from Copilot September 10, 2026 20:32
@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 Medium severity

New issues introduced by this change (2)
Severity Finding
Medium severity Directory.Build.props — Automate the warning-policy validation
Medium severity 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.

Comment thread Directory.Build.props Resolved
Comment thread NuGet.config Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@joperezr

Copy link
Copy Markdown
Member Author

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.

Evaluate the repository warning policy and pass it to Arcade's standalone MSBuild restore without duplicating warning codes. Preserve strict audit opt-in and cover both entry points, audit source separation, and CI test routing.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 3b559861-b2bb-4130-9adc-0ebe3542e70a
@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Public Bash argument forwarding remains broken, and clean-only operations now unnecessarily bootstrap the SDK.

Get a fresh assessment by requesting another Copilot review.

Review tier: Balanced
Findings: 3 Medium severity

Open findings (3)
Resolved findings (2)

Comment thread eng/build.ps1 Resolved
Comment thread eng/build.sh Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@joperezr
Jose Perez Rodriguez (joperezr) marked this pull request as draft September 14, 2026 20:01
Skip warning policy evaluation when Arcade short-circuits for clean, preserve argument boundaries in the public build and restore wrappers, and exercise these entry points in the regression matrix.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 3b559861-b2bb-4130-9adc-0ebe3542e70a
@aspire-repo-bot
aspire-repo-bot Bot requested a balanced review from Copilot September 15, 2026 20:23
@github-actions

Copy link
Copy Markdown
Contributor

Tests selector

Selects the full PR test matrix + all PR-gated jobs (ALL) — a rule matching 'Directory.Build.props' selects ALL


Selection computed for commit 80aaa7e.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The implementation preserves existing build behavior and includes focused cross-platform regression coverage.

Review tier: Balanced
Findings: None

Resolved since last review (3)

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@joperezr
Jose Perez Rodriguez (joperezr) merged commit ce1e47b into main Sep 15, 2026
797 of 800 checks passed
@joperezr
Jose Perez Rodriguez (joperezr) deleted the joperezr-aspire-nuget-config branch September 15, 2026 21:07
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 13.6 milestone Sep 15, 2026
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

✅ No documentation update needed.

Step 5 branch taken: docs_required -> false positive (Step 10 exception).

Triggered signals (1): pr_body_has_security_marker - matched the PR body 'Security considerations' section text: "Developer/CI restores retrieve public vulnerability metadata from data.nuget.org...".

Why this is a false positive: This PR only changes the microsoft/aspire repository's own internal build/CI infrastructure - NuGet.config audit sources for restoring the repo itself, Directory.Build.props, eng/WarningPolicy.proj, eng/build.ps1/eng/build.sh warning-forwarding logic, the public build.sh/restore.sh wrappers, eng/github-ci/test-trigger-map.yml routing, and docs/contributing.md (the repo's own contributor guide, not the aspire.dev docs site). None of the changed files touch an Aspire product surface (CLI commands/options, hosting/client integration APIs, dashboard, templates, or public API surface) that ships to end users of Aspire.

The 'security' language in the PR body describes the build system's NuGet vulnerability-audit configuration and warning-as-error policy for building the aspire repo itself, not a user-facing Aspire security feature. I searched src/frontend/src/content/docs/ (top-level, non-localized) for related terms (nuget audit, WarningsNotAsErrors, NuGetAudit, audit source) and found zero matches, confirming there is no existing or plausible documentation page on microsoft/aspire.dev that covers the aspire repo's own build tooling.

No docs PR was drafted since there is no concrete, in-scope documentation edit to make on the public Aspire docs site for this change.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ CI Failure Analysis: Possible Flaky Test(s)

The CI build failed due to test failure(s) that appear unrelated to the PR changes. These may be flaky tests.

Suspected flaky test(s):

  • Aspire.Hosting.Docker.Tests.DockerComposeTests.DeployWithDashboard_PrintsDashboardAndServiceEndpoints in job Tests / No-package tests (regular, Aspire.Hosting.Docker.Tests, Hosting.Docker, Hosting.Docker, tests/Asp... / Hosting.Docker (ubuntu-latest)
    • Error: Assert.Contains() Failure: Filter not matched in collection
      Collection: []
    • Stack Trace (first frames):
at Aspire.Hosting.Docker.Tests.DockerComposeTests.DeployWithDashboard_PrintsDashboardAndServiceEndpoints() in /home/runner/work/aspire/aspire/tests/Aspire.Hosting.Docker.Tests/DockerComposeTests.cs:line 460
   at Aspire.Hosting.Docker.Tests.DockerComposeTests.DeployWithDashboard_PrintsDashboardAndServiceEndpoints() in /home/runner/work/aspire/aspire/tests/Aspire.Hosting.Docker.Tests/DockerComposeTests.cs:line 500
--- End of stack trace from previous location ---
  • Why likely flaky: The test's Docker Compose 'up' operation failed with a generic exit code 1 while pulling/starting containers, causing downstream assertions on an empty output collection. This matches a documented recurring cause (docker-compose-port-already-in-use) where 'docker compose up' fails intermittently due to environment/network contention on the shared CI runner; the PR under test does not modify Docker Compose publishing code.

Suggested actions:

  • Re-run the failed CI jobs to confirm if the failure is intermittent
  • If the test continues to fail, consider quarantining it using /quarantine-test <test name> <issue URL>
  • Search existing issues to see if this test is already known to be flaky

You can re-run the failed jobs from the workflow run page.

@github-actions github-actions Bot locked and limited conversation to collaborators Oct 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants