fix(executor): run scripts with an absolute /bin/sh by default #18606
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 326 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.346
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #18606"
general
weight: 0.35
zkochan
Summary
Without a configured
scriptShell, lifecycle and run scripts were started through a baresh, and the spawn resolved it against the script's ownPATH. ThatPATHstarts with dependency.bindirectories (the package's own, its ancestors', the privately hoisted one), so any installed package that ships a bin namedshreceived every script, including the builds of dependencies approved throughallowBuilds.The default is now
/bin/sh(/system/bin/shon Android). That is the shell Node.js'sshell: trueand npm'sscript-shelldefault use, so this matches the rest of the ecosystem. A configuredscriptShellis unchanged, and so is Windows, which already usesComSpec.This is hardening. It does not try to stop a dependency's bins from shadowing other tools a script calls (
node,make, ...). A package in the dependency graph is already trusted to run its code.Tests: a lifecycle regression test plants an executable
shinnode_modules/.binand checks that the script runs without it. The test fails without the fix. Locally ranpnpm-executorandpnpm-deps-restorer(958 passed) and thelifecycle_scripts,doctor,exec,run,install_runtimesanddlxCLI modules (444 passed). Windows was not run locally.Checklist
pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
🤖 Generated with Claude Code
---
Written by an agent (Claude Code, claude-opus-5-5).
<!-- codesmith:footer -->
---
<sup><a href="https://app.blacksmith.sh/pnpm/codesmith/pnpm/pr/18606?autoLogin=true&ref=codesmith_pr_footer">Open in [code]smith</a> · Need help on this PR? Tag <code>@codesmith-bot</code> with what you need.</sup>
<!-- codesmith:autofix:disabled -->
<!-- /codesmith:footer -->
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
Bug Fixes
On non-Windows systems, lifecycle scripts now use the system shell by its absolute path by default:
/bin/sh, or/system/bin/shon Android. This prevents a dependency-providedshexecutable from being selected instead. Windows shell behavior is unchanged.Documentation
Updated script-shell guidance to specify the default shell on POSIX systems, Android, and Windows, including what is used when no shell is configured.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->