Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/publish-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,15 @@ jobs:
echo "::error::No package.json files found to validate"
exit 1
fi
# Strip registry overrides from .yarnrc.yml to prevent registry
# redirects that could exfiltrate the NPM token. npmPublishRegistry
# takes precedence over npmRegistryServer for yarn npm publish, and
# npmScopes can override per-scope. YARN_NPM_REGISTRY_SERVER env var
Copy link
Copy Markdown
Contributor

@mcmire mcmire Mar 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we no longer need to set YARN_NPM_REGISTRY_SERVER below, then? The registry URL is already configured in each workspace package's package.json (under publishConfig.registry), so we shouldn't need to override it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say it's more defense-in-depth.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes, because a PR could also update the registry for a package by updating its package.json. Okay this change makes sense.

# only overrides npmRegistryServer, not the others.
if [[ -f .yarnrc.yml ]]; then
echo "Stripping registry config from .yarnrc.yml"
yq -i 'del(.npmRegistryServer) | del(.npmPublishRegistry) | del(.npmScopes)' .yarnrc.yml
fi
for f in "${manifests[@]}"; do
# Strip lifecycle scripts that run during pack/publish
if jq -e '.scripts // {} | keys[] | select(test("^(pre|post)?(pack|publish|prepare)$"))' "$f" > /dev/null 2>&1; then
Expand Down
Loading