Skip to content

ci(release): trust the local registry only after it proves its identity - #449

Merged
santoshyadavdev merged 1 commit into
mainfrom
santoshyadavdev-fix-local-registry-auth
Nov 4, 2026
Merged

santoshyadavdev merged 1 commit into
mainfrom
santoshyadavdev-fix-local-registry-auth

Conversation

@santoshyadavdev

Copy link
Copy Markdown
Collaborator

What and why

The publish checks (verify-publish.mjs, e2e-install.mjs) treated any successful answer on the registry port as "Verdaccio is ready". Another local account holding localhost:4873 could then serve the packages these checks install and run. Child exit was only noticed after a failed answer. (CWE-346, scripts/lib/local-registry.mjs:175-177.)

Changes in scripts/lib/local-registry.mjs:

  • Fixed address: the registry uses 127.0.0.1 instead of localhost, and the run checks the port is free before Verdaccio starts.
  • Per-run secret: a random secret is seeded into Verdaccio's storage in the private work folder (mode 0700). Verdaccio must serve it back before any package command trusts the registry.
  • Registry exit: waitFor no longer accepts an answer once its process has exited, and every registry-backed run/start fails if Verdaccio has exited.
  • Tarball checks: after publish, the registry must list the tarball's sha512 and serve its exact bytes. Every install (both scenarios in verify-publish.mjs, each checkInstalled in e2e-install.mjs, and the package audit) is compared file by file with the tarball via verifyInstalled.

publish is now async, so its callers await it.

How it was verified

  • pnpm commit:check (commit messages follow the guidelines): passed
  • pnpm format:check: N/A. Prettier --write was run on the 3 changed files; the full check was not run.
  • pnpm typecheck (includes the ngc template checks): N/A, only .mjs scripts changed; node --check passes on all three
  • pnpm test, pnpm test:devtools and pnpm test:panel: N/A, no package or panel code changed
  • pnpm skills:check (when .claude/ changed): N/A
  • Docs in apps/docs updated and pnpm docs:build passes (when behavior, options, UI labels or agent tools changed), or the no-docs label added with the reason below: N/A, internal scripts only
  • pnpm extension:build and extension/ui committed (when app/ changed): N/A
  • Checked in the browser with axe (when the UI changed): N/A

Also run:

  • node scripts/e2e-install.mjs --audit-only: passed. It packs, starts Verdaccio, publishes, installs, and the installed package matches the tarball.
  • The same command with another HTTP server already on 127.0.0.1:4873: aborts with "127.0.0.1:4873 is taken" and exit code 1.
  • By hand: Verdaccio 6.11.1 serves the seeded readme back.

The full scenario matrix (all package managers) was not run locally. CI will cover it.

Screenshots

N/A

Notes for reviewers

  • Port sharing: if the OS lets another account share the port (SO_REUSEPORT), it could still answer some requests after the secret check. The tarball checks cover the package under test, but not other packages, like @angular/cli, that the registry proxies from npmjs.
  • npx path: the npx/dlx run in the CLI scenario is covered by the served-tarball check, not by verifyInstalled, because that package isn't installed into the app.
  • Exact comparison: verifyInstalled compares every file byte for byte. If a package manager rewrites a file such as package.json on install, the check will fail and show which file.
  • Secret check untested: no test runs a fake registry against the secret check.

The publish checks accepted any successful answer on the registry port, so
another local account holding localhost:4873 could serve the packages the
checks install and run. Child exit was only noticed after a failed answer.

Bind Verdaccio to 127.0.0.1 after checking the port is free, require it to
answer with a per-run secret seeded into its private storage, and stop any
registry command once it exits. waitFor no longer accepts an answer from a
port whose process has exited. After publishing, the registry must serve the
exact tarball, and every install is compared file by file with it.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 56 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ada0ec8a-78af-4b49-82b8-e99aa55e0443
Commits

Reviewing files that changed from the base of the PR and between e4ff5c8 and f7080a0.

Files selected for processing: 3
  • scripts/e2e-install.mjs
  • scripts/lib/local-registry.mjs
  • scripts/verify-publish.mjs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions github-actions Bot added the area: ci Workflows, hooks and repository tooling label Nov 4, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Failed ❌

View logs ↗
f7080a0 2026-11-04T05:49:33.691Z View logs ↗

@nx-cloud

nx-cloud Bot commented Nov 4, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit f7080a0

Command Status Duration Result
nx affected -t test build ✅ Succeeded 22s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-11-04 05:49:23 UTC

@santoshyadavdev
santoshyadavdev merged commit 9493e20 into main Nov 4, 2026
11 of 12 checks passed
@santoshyadavdev
santoshyadavdev deleted the santoshyadavdev-fix-local-registry-auth branch November 4, 2026 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci Workflows, hooks and repository tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant