Skip to content

Stop autorest upgrade-check from egressing to npmjs (CFSClean) - #3696

Merged
Ramses Sanchez-Hernandez (ramsessanchez) merged 1 commit into
mainfrom
gavinbarron/cfs-autorest-skip-upgrade
Aug 5, 2026
Merged

Stop autorest upgrade-check from egressing to npmjs (CFSClean)#3696
Ramses Sanchez-Hernandez (ramsessanchez) merged 1 commit into
mainfrom
gavinbarron/cfs-autorest-skip-upgrade

Conversation

@gavinbarron

Copy link
Copy Markdown
Member

What

Stops the residual CFSClean network-isolation violation on the PowerShell generation pipelines (187 PowerShell V2 Build, 221 Weekly PowerShell V2 Build, 663 Command-Metadata-Refresh): node.exe -> registry.npmjs.org during autorest generation.

Why

The repo already has a thorough private-feed npm setup (Configure-PrivateNpmFeed.ps1, install-tools.yml copying an authenticated .npmrc to ~/.npmrc, PrePopulateAutorestCache.ps1, and @autorest/modelerfour passed as a local --use: path). The PowerShell_V2_Build feed serves the autorest packages from itself (verified), so package downloads don't leak.

The residual egress is autorest core's upgrade check. In Azure/autorest, check-autorest-update.ts queries the public npm registry unless --skip-upgrade-check is set:

if ((await networkEnabled) && !args["skip-upgrade-check"]) {
  // isAutorestUpdateAvailable(...) -> hits registry.npmjs.org
}

The generation invocation in GenerateServiceModule.ps1 didn't set that flag, so every autorest run pinged npmjs to check for a newer @autorest/core.

Changes (tools/GenerateServiceModule.ps1)

  • Add --skip-upgrade-check to the npx --no-install autorest ... command (gates the exact code path above).
  • Set npm_config_registry from the authenticated ~/.npmrc before the call — belt-and-suspenders so any autorest npm-registry-fetch uses the private feed instead of defaulting to registry.npmjs.org. (No feed URL is hard-coded; it's read from the .npmrc that install-tools.yml already produced.)

Notes

  • The pre-populate cache already covers the only two npm extensions autorest resolves (@autorest/core, @autorest/modelerfour), and the PowerShell generator is a local submodule (use: local path) — so no cache expansion was needed; the leak was purely the upgrade check.
  • Separately, these pipelines also trip CFSClean2 on PowerShell Gallery (www/cdn.powershellgallery.com) — a looser tier, out of scope here.
  • Needs a validation run on main post-merge to confirm the registry.npmjs.org egress is gone.

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

The PowerShell generation pipelines (187/221/663) still tripped CFSClean with node.exe -> registry.npmjs.org despite the private-feed .npmrc and autorest cache pre-population. The residual leak is autorest core's upgrade check: check-autorest-update.ts calls the public npm registry unless --skip-upgrade-check is set (@autorest/modelerfour is already passed as a local --use, so it is not the source).

Add --skip-upgrade-check to the autorest invocation in GenerateServiceModule.ps1, and set npm_config_registry from the authenticated ~/.npmrc as belt-and-suspenders so any autorest npm-registry-fetch uses the private feed rather than defaulting to registry.npmjs.org.

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 22:38
@ramsessanchez
Ramses Sanchez-Hernandez (ramsessanchez) merged commit 436cf6b into main Aug 5, 2026
6 of 8 checks passed
@ramsessanchez
Ramses Sanchez-Hernandez (ramsessanchez) deleted the gavinbarron/cfs-autorest-skip-upgrade branch August 5, 2026 23:19
Ramses Sanchez-Hernandez (ramsessanchez) pushed a commit that referenced this pull request Aug 6, 2026
…an) (#3697)

PrePopulateAutorestCache.ps1 runs 'npm install <ext> --prefix <dir>' for @autorest/core and @autorest/modelerfour. With --prefix, npm did not honor the registry/auth in ~/.npmrc and reached registry.npmjs.org directly (2 hits/build) - the residual CFSClean violation on pipeline 187 after the autorest --skip-upgrade-check fix (#3696). Pass --userconfig and --registry explicitly (read from the authenticated ~/.npmrc that install-tools.yml produced) so both installs use the PowerShell_V2_Build private feed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: d3f8fec7-b00b-46be-ba39-7e1f3e7f7188
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