-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove autoshimming #235
Comments
I’m definitely in favor of not autoshimming the dependency binaries. I don’t think I’ve seen a project where a user installing a node dependency expects the binaries to be available in a general shell. We could potentially document the |
Added a big comment on the Autoshim RFC about this issue: volta-cli/rfcs#23 (comment) |
@stefanpenner I think @charlespierce really nailed the core mental-model mistake I was making in the when I first led us down the path of auto-shimming. The problem I thought we were solving was that it seemed like we had a hole in the core Notion abstraction. But as @charlespierce pointed out, there's just never an expectation with Node that package executables will be in your PATH except when called from npm scripts (which already works fine in Notion). So even setting aside your critiques, it was just solving a non-problem. Meanwhile, I also didn't like the idea that the only way to create shims would be for project maintainers to add them to some opt-in list in the manifest. But I really like the idea that shims should be tied to
@charlespierce I still think the word "shim" is somewhat of a implementation-layer concern that I'm reluctant to expose in normal user commands. What do you think of the design I sketched above? I'll work on revising the toolchains RFC to spell it out in a little more detail. |
Yup, exactly. |
@dherman Yeah, I like the approach of conceptually having a single toolchain, and having it managed by the |
This issue kicked off some fantastic design discussions. I think we've landed on a much better design, which is not only safer (in re: the concerns raised by this issue) but should be easier to understand, learn, and manage. You can see the latest iteration of the design in the toolchain RFC. I've renamed this issue to repurpose it to remove the autoshimming functionality, which shouldn't be too hard to implement. Important: Let's not implement this until we've finished implementing |
Edit by @dherman: This issue kicked off a super useful set of design discussions. We'll use it to remove autoshimming. Implementing this is blocked on #148. (See below.)
Notion automatically exposing all of
./node_modules/bin/*
to my$PATH
is quite surprising to me and I believe it may pose some serious risks.Expectations
Until now I was under the impression that
notion
was aiming to solve the "global" problem, and leave the./node_modules/.bin
executables to the likesyarn
ornpm
viapackage.json#scripts
or directly vianpx
.So for example given:
invoking
yarn test
would result in:•
yarn
being provided bynotion
mocha
invoked byyarn test
being provided byyarn
's prepending of./node_modules/.bin
to $PATHinvoking
mocha
directly in the shell would consult the$PATH
but not encounter any relevantnotion
shims, that is unless a user opted in to a globalmocha
provided bynotion
.Concerns with existing approach
On my machine, I would have hundreds unexpected executables on my
$PATH
.examples which executables which would be exposed on my machine
Unexpected shadowing
By auto exposing all executables provided by a dependency, a user may be plagued by unexpected shadowing of executables. For example, a node project with
node-which
as a dependency, would now unexpectedly shadowwhich
, with a strange node basedwhich
Some highlights:
Additional risk:
Nothing prevents a malicious user from taking advantage of this behavior, and replace an important executable such as
sudo
orsu
or ....Increased Risk of confusing which
Build tools and shells scripts commonly rely on
which <name-of-thing>
to select specific behavior. With hundreds of potentially broken detections, this risk of "heisenbug" issues arrises increases dramatically.Potential Unbounded growth of these executables
As a user uses more and more node projects, the number of these executables increase, without an obvious way to garbage collect
Recommendation
Transition from automatically installing all
./node_module/.bin
, and rather allow users to opt-in via configuration.The text was updated successfully, but these errors were encountered: