Skip to content

Look up published version via CFS feed instead of api.nuget.org (CFSClean) - #1086

Merged
Gavin Barron (gavinbarron) merged 1 commit into
mainfrom
gavinbarron/cfs-validate-version-197
Aug 5, 2026
Merged

Look up published version via CFS feed instead of api.nuget.org (CFSClean)#1086
Gavin Barron (gavinbarron) merged 1 commit into
mainfrom
gavinbarron/cfs-validate-version-197

Conversation

@gavinbarron

@gavinbarron Gavin Barron (gavinbarron) commented Aug 5, 2026

Copy link
Copy Markdown
Member

What

Fixes the sole CFSClean network-isolation violation on the Dotnet Core Production pipeline (definitionId 197): the release version-bump gate calls api.nuget.org directly.

Why

Telemetry for the last run (build 230603) shows exactly one CFSClean violation — pwsh.exe -> api.nuget.org in the build job. It comes from the Validate updated version step, which runs scripts/ValidateUpdatedNugetVersion.ps1:

$url = "https://api.nuget.org/v3/registration5-gz-semver2/$packageName/index.json"
$nugetIndex = Invoke-RestMethod -Uri $url -Method Get

This is a REST call (not a package restore) to read the latest published version. dotnet restore in this repo is already CFS-clean; only this lookup egresses to nuget.org.

Changes

  • scripts/ValidateUpdatedNugetVersion.ps1: add a -registrationsBaseUrl parameter (default stays https://api.nuget.org/v3/registration5-gz-semver2 for back-compat), and send Authorization: Bearer $env:SYSTEM_ACCESSTOKEN when set. Broaden the graceful "first publish" handling to HTTP 404, and fix the && condition to -and.
  • pipelines/productionBuild.yml (Validate updated version step): pass the CFS feed registrations endpoint (GraphDeveloperExperiences_Public, which upstreams nuget.org) and expose SYSTEM_ACCESSTOKEN: $(System.AccessToken).

Validation

Ran the modified script locally against the CFS feed: it authenticated, returned the same latest version (4.0.1) as nuget.org, and produced the identical gate result (version-bump error when csproj == published). No api.nuget.org egress.

Relates to S360 KPI 527fb616-07aa-8198-6419-50d04ef1c2f3 (Vulnerability Management / 1ES network isolation).

Microsoft Reviewers: Open in CodeFlow

…lean)

The 'Validate updated version' gate in productionBuild.yml runs ValidateUpdatedNugetVersion.ps1, which Invoke-RestMethod's api.nuget.org directly (pwsh.exe -> api.nuget.org) - the sole CFSClean network-isolation violation on pipeline 197 (Dotnet Core Production).

Parameterize the registrations base URL (default stays nuget.org for back-compat) and send SYSTEM_ACCESSTOKEN as a bearer token when set; point the pipeline step at the CFS feed's registrations2 endpoint (GraphDeveloperExperiences_Public, which upstreams nuget.org). Verified the feed returns the same latest version (4.0.1) so the gate is unchanged. Also broaden the graceful first-publish handling to HTTP 404 and fix the '&&' condition to '-and'.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d3f8fec7-b00b-46be-ba39-7e1f3e7f7188
@gavinbarron
Gavin Barron (gavinbarron) requested a review from a team as a code owner August 5, 2026 18:33
@gavinbarron
Gavin Barron (gavinbarron) added this pull request to the merge queue Aug 5, 2026
Merged via the queue into main with commit a185da1 Aug 5, 2026
8 of 9 checks passed
@gavinbarron
Gavin Barron (gavinbarron) deleted the gavinbarron/cfs-validate-version-197 branch August 5, 2026 20:43
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