Skip to content

Fix CFS feeds#4976

Merged
hanniavalera merged 1 commit into
mainfrom
dev/hanniavalera/networkCG
Jun 16, 2026
Merged

Fix CFS feeds#4976
hanniavalera merged 1 commit into
mainfrom
dev/hanniavalera/networkCG

Conversation

@hanniavalera

Copy link
Copy Markdown
Contributor

The prior commit a3316fa deleted the user .npmrc and left always-auth=true in the project .npmrc, but neither was the cause of the E401. The actual cause: the azure-public/cpp_PublicPackages CFS feed under CFSClean network isolation only serves package versions that have already been saved to the feed - it does not transparently pull from upstream npmjs. Requests for yarn@1.22.19 return 401 because that tarball is not in the feed; yarn@1.22.22 IS in the feed and IS pre-installed on the 1ESPT-Windows2025 image. The npm error 'authentication token seems to be invalid' is just how npm formats any 401 with a WWW-Authenticate: Bearer header.

This change adopts the working microsoft/vscode-cpptools and microsoft/vscode-makefile-tools loc pipeline pattern:

  • Use pre-installed Yarn 1.22.22 (no npm install -g yarn).
  • Use @vscode/vsce from devDependencies via 'yarn run vsce' (no npm install -g @vscode/vsce) in pipelines that check out the repo.
  • Drop always-auth=true from .npmrc. It is a no-op for anonymous CFS reads in both clients: npm 10 ignores it entirely (removed in v7.11.1, will warn/error in npm 11/12), and Yarn 1 gates the Authorization header behind 'if (authorization)' so it has no effect without a configured credential. Mirrors Remove always-auth. vscode-cpptools#13377.
  • Bump the packageManager field to yarn@1.22.22 to match the pre-installed Yarn the signing pipelines now rely on.
  • Keep the del %USERPROFILE%.npmrc cleanup step and the npm_config_registry env on yarn/vsce steps as defense-in-depth. Both are no-ops on the current 1ESPT-Windows2025 image and yarn.lock pinning, but guard against future image changes that inject a scoped .npmrc or a tool that reads npm_config_registry directly.

The release.yml / prerelease.yml release jobs do not check out the repo, so they cannot use the devDependency. They keep 'npm install -g @vscode/vsce' but pin to @3.1.0 - the same version the build pipelines resolve via yarn.lock, verified saved in the CFS feed. Without a pin, npm would resolve 'latest' to 3.9.2, which is NOT saved in the feed and 401s; a3316fa inherited this latent bug from #4086. Pinning to 3.1.0 keeps the package, sign, and publish steps on a single vsce version.

Long-term, the cleaner fix is to bundle vsce into the vsix artifact so release jobs never hit the feed for tooling.

The prior commit a3316fa deleted the user .npmrc and left always-auth=true
in the project .npmrc, but neither was the cause of the E401. The actual cause:
the azure-public/cpp_PublicPackages CFS feed under CFSClean network isolation
only serves package versions that have already been saved to the feed - it
does not transparently pull from upstream npmjs. Requests for yarn@1.22.19
return 401 because that tarball is not in the feed; yarn@1.22.22 IS in the
feed and IS pre-installed on the 1ESPT-Windows2025 image. The npm error
'authentication token seems to be invalid' is just how npm formats any 401
with a WWW-Authenticate: Bearer header.

This change adopts the working microsoft/vscode-cpptools and
microsoft/vscode-makefile-tools loc pipeline pattern:
- Use pre-installed Yarn 1.22.22 (no npm install -g yarn).
- Use @vscode/vsce from devDependencies via 'yarn run vsce' (no npm install
  -g @vscode/vsce) in pipelines that check out the repo.
- Drop always-auth=true from .npmrc. It is a no-op for anonymous CFS reads
  in both clients: npm 10 ignores it entirely (removed in v7.11.1, will
  warn/error in npm 11/12), and Yarn 1 gates the Authorization header
  behind 'if (authorization)' so it has no effect without a configured
  credential. Mirrors microsoft/vscode-cpptools#13377.
- Bump the packageManager field to yarn@1.22.22 to match the pre-installed
  Yarn the signing pipelines now rely on.
- Keep the del %USERPROFILE%\.npmrc cleanup step and the npm_config_registry
  env on yarn/vsce steps as defense-in-depth. Both are no-ops on the current
  1ESPT-Windows2025 image and yarn.lock pinning, but guard against future
  image changes that inject a scoped .npmrc or a tool that reads
  npm_config_registry directly.

The release.yml / prerelease.yml release jobs do not check out the repo, so
they cannot use the devDependency. They keep 'npm install -g @vscode/vsce'
but pin to @3.1.0 - the same version the build pipelines resolve via
yarn.lock, verified saved in the CFS feed. Without a pin, npm would resolve
'latest' to 3.9.2, which is NOT saved in the feed and 401s; a3316fa
inherited this latent bug from #4086. Pinning to 3.1.0 keeps the package,
sign, and publish steps on a single vsce version.

Long-term, the cleaner fix is to bundle vsce into the vsix artifact so
release jobs never hit the feed for tooling.
@hanniavalera hanniavalera requested a review from snehara99 June 16, 2026 15:26
@hanniavalera hanniavalera enabled auto-merge (squash) June 16, 2026 15:27
@hanniavalera hanniavalera merged commit 79a2cc5 into main Jun 16, 2026
29 checks passed
@hanniavalera hanniavalera deleted the dev/hanniavalera/networkCG branch June 16, 2026 16:03
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