Skip to content

ci(npm): disable publish lifecycle scripts#90

Open
BunsDev wants to merge 1 commit into
mainfrom
codex/propose-fix-for-npm-publish-vulnerability
Open

ci(npm): disable publish lifecycle scripts#90
BunsDev wants to merge 1 commit into
mainfrom
codex/propose-fix-for-npm-publish-vulnerability

Conversation

@BunsDev

@BunsDev BunsDev commented Jun 15, 2026

Copy link
Copy Markdown
Member

Motivation

  • The npm publish workflow injected NODE_AUTH_TOKEN into the publish step and ran npm publish without disabling lifecycle scripts, allowing release-controlled prepublishOnly/prepare/prepack scripts to read or exfiltrate the token.

Description

  • Add --ignore-scripts to both npm publish invocations in .github/workflows/npm-publish.yml to prevent checked-out release package lifecycle scripts from executing with NODE_AUTH_TOKEN, while preserving provenance and publish behavior.

Testing

  • Ran git diff --check and a local dry-run by adding malicious prepublishOnly/prepack/prepare scripts to a temp copy of npm/package.json then executing NODE_AUTH_TOKEN=POC_NPM_TOKEN_123 npm publish --dry-run --ignore-scripts --foreground-scripts --access public and verified the scripts did not run and no token leakage occurred.

Codex Task

Copilot AI review requested due to automatic review settings June 15, 2026 13:22
@vercel

vercel Bot commented Jun 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Jun 15, 2026 1:22pm

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Hardens the npm publish GitHub Actions workflow by preventing npm lifecycle scripts from running during publish, mitigating the risk of NODE_AUTH_TOKEN exfiltration.

Changes:

  • Add --ignore-scripts to scoped package npm publish invocation.
  • Add --ignore-scripts to unscoped package npm publish invocation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 262 to +266
prepare_package "$package_name"
if [[ "$package_name" == @*/* ]]; then
(cd npm && npm publish --access public --provenance)
(cd npm && npm publish --access public --provenance --ignore-scripts)
else
(cd npm && npm publish --provenance)
(cd npm && npm publish --provenance --ignore-scripts)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants