fix(security): replace npx with npm exec to prevent unintended remote package execution#106
fix(security): replace npx with npm exec to prevent unintended remote package execution#106frankieyan merged 2 commits intomainfrom
Conversation
… package execution npx silently downloads and runs packages from the registry if they aren't installed locally, which is a supply chain security risk. npm exec only runs already-installed packages. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
doistbot
left a comment
There was a problem hiding this comment.
This PR updates the codebase and documentation to replace npx with npm exec in an effort to mitigate the security risk of unintended remote package downloads. This is a valuable step toward tightening supply chain security across our development workflows. However, because modern npm allows remote lookups by default for both commands, successfully enforcing local-only execution requires appending the --no flag and -- separator to all updated instances.
npm exec without --no still allows fetching uninstalled packages from the registry, just like npx. The --no flag ensures only locally installed packages can be executed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
doistbot
left a comment
There was a problem hiding this comment.
This PR replaces instances of npx with npm exec across the repository to improve supply chain security by preventing unintended remote package execution. This is a great proactive step that strengthens the security posture of the project's tooling and documentation. However, the update to the integration tests will likely cause failures because tsx is not installed in the fixture's local package.json, which will cause npm exec to exit with a missing-package error rather than running the CLI.
Overview
npxsilently downloads and executes packages from the npm registry when they aren't installed locally, which is a supply chain security risk. This replaces allnpxusage withnpm exec, which only runs packages already present innode_modules.Changes
.husky/pre-commit:npx lint-staged→npm exec lint-stagedsrc/index.integration.test.ts:npx tsx→npm exec tsx --README.md: all user-facing examples updated fromnpxtonpm execwith--separators where arguments are passedTest plan
npm testto verify integration tests still pass🤖 Generated with Claude Code