Skip to content

fix(pipelines): route NuGet version check through CFS feed to resolve CFSClean violation - #1146

Merged
gavinbarron merged 3 commits into
mainfrom
gavinbarron-fix-cfsclean-failure
Aug 5, 2026
Merged

fix(pipelines): route NuGet version check through CFS feed to resolve CFSClean violation#1146
gavinbarron merged 3 commits into
mainfrom
gavinbarron-fix-cfsclean-failure

Conversation

@gavinbarron

@gavinbarron gavinbarron commented Aug 5, 2026

Copy link
Copy Markdown
Member

Summary

Resolves the single CFSClean (SFI-ES4.2.4 network isolation) violation flagged in the build stage's 🔒 Stop Network Isolation step of the Dotnet Beta Preview pipeline (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):

Policy: CFSClean - Policy required for SFI compliance. Status = [ NOT COMPLIANT ] (1 violations)
##[group]api.nuget.org
  Domain name: api.nuget.org
  Service tags: AzureFrontDoor.Frontend
  IP address: 13.107.226.40
  Process path: C:\Program Files\PowerShell\7\pwsh.exe
  Task name: PowerShell
##[endgroup]

Policy: CFSClean2 - Status = [ COMPLIANT ]
Policy: CFSClean3 - Status = [ COMPLIANT ]
Policy: Default Deny - Status = [ COMPLIANT ]

Root cause

The Validate updated version PowerShell@2 step (running scripts/ValidateUpdatedNugetVersion.ps1) calls the public NuGet.org search API directly via Invoke-RestMethod to check whether the current csproj version has already been published. This is a direct connection from a pwsh.exe/PowerShell process to a public package registry domain (api.nuget.org/azuresearch-usnc.nuget.org), which trips the CFSClean policy — separate from and unrelated to the earlier dotnet restore CFS 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 -nugetConfigPath parameter and replaced the raw Invoke-RestMethod call to the public NuGet.org search API with dotnet package search --configfile <nuget.config>, querying the same Central Feed Service (CFS) feed already configured and authenticated (via NuGetAuthenticate@1) for dotnet 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 earlier Create nuget.config (central feed) step) to the script invocation.

Validation

  • PowerShell parser check: [System.Management.Automation.Language.Parser]::ParseFile(...) — no syntax errors.
  • Functional dry-run locally with a temporary nuget.config pointed at https://api.nuget.org/v3/index.json (as a stand-in for the private CFS feed, to prove the dotnet package search --configfile mechanism) covering all three script branches:
    • Version already ahead of latest published → Validated that the version has been updated ... (exit 0)
    • Version not incremented (matches/behind latest published) → Write-Error with the original message (unchanged behavior)
    • Non-existent package name → graceful No package exists... first-time-publish message (exit 0)
  • Confirmed no other files reference the script's old two-argument signature.

Cannot trigger a live ADO run from this session to directly re-confirm the Stop Network Isolation compliance status, but the fix eliminates the only direct public-registry call in the build job, matching the same remediation pattern already used for dotnet restore.

Microsoft Reviewers: Open in CodeFlow

gavinbarron and others added 2 commits August 4, 2026 17:49
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
gavinbarron requested a review from a team as a code owner August 5, 2026 01:01
@gavinbarron
gavinbarron enabled auto-merge (squash) August 5, 2026 01:12
@gavinbarron
gavinbarron merged commit cc5f8e8 into main Aug 5, 2026
5 checks passed
@gavinbarron
gavinbarron deleted the gavinbarron-fix-cfsclean-failure branch August 5, 2026 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants