fix(pipelines): route NuGet version check through CFS feed to resolve CFSClean violation - #1146
Merged
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 03d194c7-5fba-4802-a182-3b3ef5c5c0ab
… CFSClean violation The 'Validate updated version' PowerShell@2 step in the build job called the public NuGet.org search API (azuresearch-usnc.nuget.org) directly via Invoke-RestMethod. The pipeline's Network Isolation task flags this as a CFSClean (SFI-ES4.2.4) violation for connections to api.nuget.org made by a PowerShell process, reported in the build job's 'Stop Network Isolation' step. ValidateUpdatedNugetVersion.ps1 now accepts a -nugetConfigPath parameter and queries the package's published versions via 'dotnet package search' against the already-configured Central Feed Service nuget.config (the same feed used by 'dotnet restore'), which proxies to NuGet.org as an upstream source. This keeps the version check functional while routing the network call through the CFS-approved path instead of nuget.org directly. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
gavinbarron
enabled auto-merge (squash)
August 5, 2026 01:12
peombwa
approved these changes
Aug 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves the single CFSClean (SFI-ES4.2.4 network isolation) violation flagged in the build stage's
🔒 Stop Network Isolationstep of theDotnet Beta Previewpipeline (ADO pipeline ID 199,pipelines/ci-build.yml).Exact finding / log evidence
From the build job's "Stop Network Isolation" step log (build 227727, log id 68):
Root cause
The
Validate updated versionPowerShell@2step (runningscripts/ValidateUpdatedNugetVersion.ps1) calls the public NuGet.org search API directly viaInvoke-RestMethodto check whether the current csproj version has already been published. This is a direct connection from apwsh.exe/PowerShellprocess to a public package registry domain (api.nuget.org/azuresearch-usnc.nuget.org), which trips the CFSClean policy — separate from and unrelated to the earlierdotnet restoreCFS fix (#1139), which only covered the restore operation.A prior commit on this branch (
avoid blocked NuGet registration endpoint) had already swapped one direct nuget.org endpoint for another (registration API → search API) to fix a functional blocking issue, but neither endpoint is CFS-routed, so the compliance violation persisted.Fix
scripts/ValidateUpdatedNugetVersion.ps1: added a required-nugetConfigPathparameter and replaced the rawInvoke-RestMethodcall to the public NuGet.org search API withdotnet package search --configfile <nuget.config>, querying the same Central Feed Service (CFS) feed already configured and authenticated (viaNuGetAuthenticate@1) fordotnet restore. That feed has NuGet.org configured as an upstream source, so it transparently proxies the search — keeping the check functional while eliminating the direct-to-public-registry network call.pipelines/ci-build.yml: pass-nugetConfigPath "$(Build.SourcesDirectory)\nuget.config"(the file already created by the earlierCreate nuget.config (central feed)step) to the script invocation.Validation
[System.Management.Automation.Language.Parser]::ParseFile(...)— no syntax errors.nuget.configpointed athttps://api.nuget.org/v3/index.json(as a stand-in for the private CFS feed, to prove thedotnet package search --configfilemechanism) covering all three script branches:Validated that the version has been updated ...(exit 0)Write-Errorwith the original message (unchanged behavior)No package exists...first-time-publish message (exit 0)Cannot trigger a live ADO run from this session to directly re-confirm the
Stop Network Isolationcompliance status, but the fix eliminates the only direct public-registry call in the build job, matching the same remediation pattern already used fordotnet restore.Microsoft Reviewers: Open in CodeFlow