TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Node.js packages don't deserve trust

432 点作者 lewisjoe大约 3 年前

52 条评论

lucacasonato大约 3 年前
Deno core team member and TC39 delegate here.<p>We have pondered about capability based security for Deno in the past. Our conclusion has always been that this is not possible to do securely in JS without freezing all prototypes and objects by default. The reasoning for this is that you need to make sure the capability token does not ever leak. For example as a malicious user I could override `globalThis.fetch` to exfiltrate the capability token destined for `fetch` and use it myself later.<p>One could also override `Map.prototype.set` &#x2F; `Map.prototype.get` to exfiltrate a token every time it is added or removed from a `Map` (people will want to store tokens in a `Map`).<p>One could also override `Array.prototype[Symbol.iterator]` to exfiltrate tokens stored in arrays if those arrays are destructored, spread, etc.<p>There are many more cases like this, where one can exfiltrate tokens because of the very dynamic nature of JavaScript.<p>It is unlikely that freezing all intrinsic prototypes and objects is even enough. People will find ways to exfiltrate tokens.
评论 #30990043 未加载
评论 #30992658 未加载
评论 #30989937 未加载
评论 #30991556 未加载
评论 #30991575 未加载
评论 #30992198 未加载
评论 #30999051 未加载
评论 #30991382 未加载
评论 #30991164 未加载
评论 #30992622 未加载
评论 #30996496 未加载
keb_大约 3 年前
The impression I get from the companies I&#x27;ve worked at is to not trust packages that are mostly maintained by one person. Ironically, those packages are usually the ones that don&#x27;t have outrageously large dependency trees and can usually be audited by a developer on a weekend, and the more &quot;trustworthy&quot; larger packages with hundreds of maintainers typically have monstrous dependency trees.<p>Not saying 1-man tools are inherently better, but in my experience, these tools seems to have a tighter focus and less chances of scope&#x2F;dependency creep.
评论 #30989720 未加载
评论 #30990117 未加载
评论 #30989557 未加载
评论 #30989654 未加载
评论 #30990079 未加载
评论 #30989747 未加载
feross大约 3 年前
Founder of Socket (<a href="https:&#x2F;&#x2F;socket.dev" rel="nofollow">https:&#x2F;&#x2F;socket.dev</a>) here, a new tool built by npm maintainers to help solve JavaScript supply chain security.<p>I totally agree with the idea that we should assume all open source packages may be malicious. Socket.dev uses &quot;deep package inspection&quot; to characterize the behavior of an open source package. By actually analyzing the package code, Socket can detect when packages use security-relevant platform capabilities, such as the network, filesystem, or shell.<p>For instance, to detect if a package uses the network, Socket looks at whether fetch(), or Node&#x27;s net, dgram, dns, http or https modules are used within the package or any of its dependencies.<p>This entails running static analysis (and soon, dynamic analysis) on a package – and all of its dependencies – to look for specific risk markers.<p>In this way, Socket can detect the tell-tale signs of a supply chain attack, including the introduction of install scripts, obfuscated code, high entropy strings, or usage of privileged APIs such as shell, filesystem, eval(), and environment variables.<p>We are taking an entirely new approach to one of the hardest problems in security in a stagnant part of the industry that has historically been obsessed with just reporting on known vulnerabilities.
评论 #30992604 未加载
评论 #30993740 未加载
donatj大约 3 年前
I think Go modules version resolution opting for <i>lowest</i> common release rather than the standard <i>highest</i> is a reasonable and sane option though not a total solution. It prevents users of your library from pulling unvetted versions of your dependencies just by pulling your library alone.
评论 #30988765 未加载
porsager大约 3 年前
This won&#x27;t prevent packages you&#x27;re already giving capabilities to - to later do something evil in a small patch update.<p>So it&#x27;s not enough - you should also not rely on &quot;automatic security updates&quot; through some sort of semver trust. Lock your dependencies up completely, choose packages with a small dependency tree or zero dependencies, and at the same time use the newly launched <a href="https:&#x2F;&#x2F;socket.dev" rel="nofollow">https:&#x2F;&#x2F;socket.dev</a> to know what packages do. Also reading through the source of your dependencies should be on the list.
评论 #30988775 未加载
评论 #30991539 未加载
mark_and_sweep大约 3 年前
I&#x27;m surprised the author doesn&#x27;t mention Node&#x27;s Policies: <a href="https:&#x2F;&#x2F;nodejs.org&#x2F;dist&#x2F;latest&#x2F;docs&#x2F;api&#x2F;policy.html" rel="nofollow">https:&#x2F;&#x2F;nodejs.org&#x2F;dist&#x2F;latest&#x2F;docs&#x2F;api&#x2F;policy.html</a><p>&quot;Policies are a security feature intended to allow guarantees about what code Node.js is able to load.&quot;
评论 #30988716 未加载
danShumway大约 3 年前
Good article. This is what I was excited about the first time I heard about Deno before I eventually learned what Deno&#x27;s sandboxing model actually was. I&#x27;m not sure this is the exact proposal I would want, but I do want something vaguely like scopes or capabilities in Node, and even if it wasn&#x27;t perfect I think it would go a long way towards mitigating at least some of the current risk in the ecosystem.<p>Also agreed that for all their use, it would have been better in the long run if install scripts had never existed. It&#x27;s not just that they&#x27;re a security vulnerability, they also get in the way of vendoring code, and can introduce additional non-JS dependencies and errors on other systems&#x2F;platforms. Again, not to say that they don&#x27;t have any use, I get why they&#x27;re there. I just wonder if the benefits are worth the downsides.
didip大约 3 年前
In the beginning of node.js life, NPM the company had a guerilla marketing that says: The smaller the package, the better for reusability.<p>That stained the node.js ecosystem forever, until now.<p>This is why I am excited about Deno, Ryan wants to break away from this culture.
评论 #30990200 未加载
评论 #30998796 未加载
评论 #30989887 未加载
filleokus大约 3 年前
Could a path forward also be to unify the most depended upon small packages into one large dependency, managed by some trustworthy entity?<p>I guess some plug-in to npm could handle the resolution-mapping between the (9 line) strip-ansi package and the node-standard-library package?<p>Of course this don’t solve all problem, but if a create-react style app could lower its number of dependencies by 80% or something, it would be easier to keep track of the remaining.<p>Because even if you have some kind of capability system, you are still pretty vulnerable to miss behaving packages. Even if the scope of badness is dramatically lower, chaos would ensue in many build pipelines if some of these “core” package just started throwing exceptions &#x2F; returning empty objects
评论 #30989712 未加载
评论 #30989779 未加载
chha大约 3 年前
No packages or repositiories deserves trust, at least not in the current state of affairs. There is no magic fix that will enable you to trust packages just by adding a new framework or anything similar, and what the linked article is addressing is only half the problem.<p>We also need a way to make packages auditable. Package signing by the publisher and the repository needs to be mandatory. Having an actual link between the package and the commit it was built on and a way to reproduce the build[1] also needs to be possible. This would allow for proper code reviews, not just of your own code but also audits of whatever extra components you are using.<p>Organizations need to define sensible thresholds for when you can use a package and when you implement the code yourself, to avoid adding a library only to use one function. They also need to define trust; what is needed to trust a package or a maintainer.<p>And we need a system and proper best practice to guide us on what to trust; do we really want to add a package with 100 direct or transitive dependencies, where some hasn&#x27;t been updated for the past two years, some are maintained by solo developers and some are just implementing already existing functionality?<p>All of these are hard to implement and justify, when the current situation seem to work for a lot of people.<p>[1] - <a href="https:&#x2F;&#x2F;wiki.debian.org&#x2F;ReproducibleBuilds" rel="nofollow">https:&#x2F;&#x2F;wiki.debian.org&#x2F;ReproducibleBuilds</a>
lucideer大约 3 年前
TL;DR: There&#x27;s nothing fundamentally less worthy of trust about node&#x27;s supply chain than any other popular mainstream language ecosystem. They&#x27;ve all got some badness.<p>---<p>Here&#x27;s a trope I&#x27;m tired of:<p>Take X general problem that affects a wide range of systems, attribute it to one narrow system Y. Usually because that system Y&#x27;s general accessibility and success leads to a higher number of high profile incidents related to problem X.<p>One of the practical outcomes of this trope is people trying to solve this problem in narrow, ecosystem-specific, non-portable ways.
评论 #30988642 未加载
评论 #30988677 未加载
评论 #30988510 未加载
评论 #30989449 未加载
评论 #30988562 未加载
评论 #30989837 未加载
评论 #30988410 未加载
评论 #30988706 未加载
评论 #30990264 未加载
评论 #30988538 未加载
评论 #30989430 未加载
cryptica大约 3 年前
It doesn&#x27;t make sense to build this &#x27;capabilities&#x27; feature into the program itself. It feels a bit like taping your mouth shut in order to lose weight.<p>It doesn&#x27;t make sense for a program to not trust its own code any more than it makes sense for a person to not trust their own thoughts.<p>There is no need to pollute your code like this. It should be implemented as an external tool which analyzes dependencies when executed on demand. A company could just run this tool as part of their CI pipeline before code is deployed or executed. It could be a default hook which runs automatically as part of npm install. It should not be part of the code itself. It&#x27;s ugly and adds unnecessary overhead and complexity.<p>It&#x27;s possible that an external tool executed at compile-time would not be able to verify modules which come with C&#x2F;C++ bindings, but I think it would be difficult to stop these anyway (even at runtime). C&#x2F;C++ bindings will always be less secure because it&#x27;s harder to understand what&#x27;s going on if you don&#x27;t have access to the code. C&#x2F;C++ is too powerful; you can do some crazy stuff with buffer overflows which would be difficult to detect anyway even at runtime. The solution is to try to stick to modules which rely only on native Node.js functionality and not on custom C&#x2F;C++ bindings.
macspoofing大约 3 年前
What&#x27;s different between the NPM ecosystem, and, say, java&#x2F;maven? What is the latter doing that the former isn&#x27;t?
评论 #30988979 未加载
评论 #30988783 未加载
评论 #30991594 未加载
评论 #30990029 未加载
评论 #30988834 未加载
评论 #30988856 未加载
评论 #30988703 未加载
评论 #30988893 未加载
评论 #30991892 未加载
评论 #30989468 未加载
egeozcan大约 3 年前
Why put a sensational headline instead of something that describes what the post is really about?<p>Something like &quot;A capabilities based system for node.js packages&quot;, perhaps?
评论 #30988460 未加载
andix大约 3 年前
We need one or a few well maintained standard library for Node and&#x2F;or Browser-JS.<p>Those must not depend on any other libraries. And then packages can reduce their dependencies vastly, by just referencing one standard library, that provides a lot of features.
评论 #30989558 未加载
roryrjb大约 3 年前
I was exploring the actual implementation[0] of a capabilities feature in Nodejs and was utilising seccomp (via libseccomp) on Linux at least to achieve a greater degree of security than might otherwise be possible by remaining in userland code. The idea is that you&#x27;d write your code, import whatever you like and define your capabilities upfront at initialisation. The problem is there&#x27;s quite a big disconnect between what you are doing in JavaScript and what&#x27;s happening with system calls in v8, libuv and the other native parts that it&#x27;s difficult to predict what you need to block and what&#x27;s actually going to happen. So I don&#x27;t think my approach is really viable in a general sense, although capabilities in general I think would improve the situation if the wider community were to adopt the approach.<p>[0]. <a href="https:&#x2F;&#x2F;github.com&#x2F;roryrjb&#x2F;node-seccomp" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;roryrjb&#x2F;node-seccomp</a>
评论 #30992972 未加载
Kaze404大约 3 年前
This article made me wonder about packages calling user code. Using express&#x27; example, what if I don&#x27;t want to give it filesystem access but need it in one of my callbacks? Is the engine capable of distinguishing my (privileged) code from express&#x27; (unprivileged) code?
评论 #30989722 未加载
systemvoltage大约 3 年前
This is similar to electronics supply chain. If you source from shady component distributors, you’re going to get bitten with something like a faulty capacitor with an annoying frequency in volume. The difference here is that a single vulnerability can take down your entire app or worse. It’s like sourcing components that can potentially do irreversible fire damage to your customers.<p>This is why they rely on trust worthy distributors and manufacturers. Without payment incentive and with high expectations for free stuff, this is not possible to solve.<p>Billion dollar companies building on people’s hobby projects. In any other industry, this would be unprofessional.
评论 #30990218 未加载
andrewmcwatters大约 3 年前
No, Go solves this problem and Deno explicitly copies its design. Just use Go. Seriously. The stupidest thing npm still does today is naively assume SemVer is an appropriate strategy for automatic updates.<p>There is so such thing as an appropriate strategy for automatic updates for developers. For end users? Sure. Because the assumption for them is that things are stable.<p>Developers need to check. Developers need to pin.<p>If you’re working in the Node.js ecosystem the solution isn’t to throw the baby out with the bath water and use Deno, it’s to `—save-exact`.<p>I’m sure as hell not throwing away all of the hours invested in now stable JavaScript software.
mikece大约 3 年前
&quot;The fundamental problem with npm is that any package you install has full access to do whatever it wants on your computer.&quot;<p>Is it uncommon to use dedicated VMs for development for this very reason?
评论 #30988484 未加载
评论 #30988482 未加载
评论 #30988552 未加载
评论 #30988683 未加载
评论 #30988524 未加载
评论 #30988505 未加载
cabirum大约 3 年前
Can we identify nodejs projects, which - a) are trivial to implement and, b) are most depended upon?<p>I&#x27;d love to contribute to a coordinated community effort to minimize the number of npm dependencies.
评论 #30991637 未加载
评论 #30990357 未加载
etchalon大约 3 年前
Seeing how there are dozens of package management toolchains out there, why is NPM so uniquely absolutely horrible?<p>The only behavioral difference I see is that with most other package tools, installing a dependency pins the specific version of the dependency you installed.<p>So why does NPM instead pin &quot;any version at least this, or greater&quot;?<p>Feels like a decision that was made when the tooling was young to help improve reliability that has since created this nightmare. Is Yarn better about it?
评论 #30990195 未加载
评论 #30990418 未加载
评论 #30991684 未加载
评论 #30990014 未加载
评论 #30989969 未加载
jmull大约 3 年前
I think making the capabilities the responsibility of the app (i.e., having the app handle tokens and pass them around) won&#x27;t work, for a couple reasons:<p>(A) it&#x27;s tricky for the app to protect itself. The executing app code tells the system what the executing app code is allowed to do. It&#x27;s tricky to get right -- you have to manage the trust boundaries internally yourself, and it will be easy to get wrong.<p>(B) capabilities tend to depend on the environment, not just the app. E.g., production vs. staging vs. dev environments may well want different capabilities.<p>(C) capabilities are probably best expressed declaratively, but putting tokens into into APIs makes the app handle them procedurally. Once an apps capabilities need to go beyond the trivial, this will really explode the complexity, making it brittle and very difficult to handle correctly. E.g. suppose you use express... how would it know how to pass tokens to its dependencies? It would sort of need to understand your app&#x27;s security model, which it can&#x27;t do. What would actually happen is express would presume a certain model and pass tokens it receives accordingly. App dev would adjust the tokens it passes to express, adjusting until it works. So that at least works even if responsibilities are mixed up. But now express can&#x27;t make internal changes to the way it calls it dependencies without risk of breaking apps that take the update.<p>Anyway, I&#x27;m thinking the capabilities need to be specified external to the app.<p>Say, in a config file (or files) of some sort. The app could only be allowed at most read access to the capabilities file(s); (A). There are some pretty common and straightforward ways to customize config for different environments; (B). A config file lends itself naturally to a declarative form; (C).
bspammer大约 3 年前
This token system requires changing code, why not extend package.json with a declared list of permissions instead?
评论 #30989199 未加载
jameshart大约 3 年前
This is a noble proposal but it requires far too many systems to collaborate on adopting it.<p>A capabilities system based on optional package metadata seems easier to introduce (think about how typings have been able to progressively layer on top of existing packages)
pojzon大约 3 年前
Every time I read anything about JS, WAT comes to my mind and that explains why everything in web UI domain would require a complete bottom-up rewrite.<p>And ofcourse that is why it will never happen. We just keep on digging deeper in mud same as with climate..
评论 #30993110 未加载
phendrenad2大约 3 年前
Of course this is a problem for all package repositories. Ruby, Python, Docker, Node, etc. But Node seems especially bad. Why? It seems to me that Node packages are mostly the work of a single person, and lack a community around them. You know you can trust Nokogiri because there are many developers working on it, and they&#x27;re visible and accessible on Twitter et al. But many Node modules are just one person&#x27;s passion project and&#x2F;or resume padder. It&#x27;s too easy for someone to have their npm publish keys stolen and not notice, whereas if there were more people on the project someone would probably notice sooner.
评论 #30991582 未加载
bjpbakker大约 3 年前
A capabilities system like pledge could be a way to safer use _existing_ packages. However, I think that it&#x27;s not a very nice way to continue. Every application will end up doing its own capability pledging, and mistakes will be made. A lot.<p>Another approach could be to use an effect system like PureScript does. The main problem with Node.js packages is that any function you use can execute arbitrary code (such as wiping systems with an IP that is from the Russian region). Having an effect system in place the library author has no other means than to come forward with the side-effect, or code won&#x27;t compile.
mike_hearn大约 3 年前
Hmm, where to begin? This is an old idea. It has all been tried before in the JVM world and yet support for it is now being <i>removed</i>, which is in my view a pity given that Now Is The Time. But the problems encountered trying to make it work well were real and would need to be understood by anyone trying the same in the JS world.<p>Understand that Java had it relatively easy. Java was designed with a sandbox as part of the design from day one, the venerable SecurityManager. The language has carefully controlled dynamism and is relatively easy to statically and dynamically analyze, at least compared to JavaScript. The libraries were designed more or less with this in mind, and so on.<p>So what went wrong?<p>Firstly, the model whereby you start with a powerful &quot;root&quot; capability and then shave bits off doesn&#x27;t have particularly good developer usability. It requires you to manually thread these little capabilities through the call stack and heap, which is a nightmare refactoring job even in a language like Java let alone something with sketchy refactoring tooling like JavaScript. <i>Lots</i> of APIs become awkward or impossible, something as basic as:<p><pre><code> var lines = readFile(&quot;library-data.txt&quot;); </code></pre> is now impossible because there&#x27;s no capability there, yet, developers do expect to be able to write such code. Instead it would have look like this:<p><pre><code> function readFile(appDataPath) { var url = appDataPath.resolve(&quot;library-data.txt&quot;); var lines = appDataPath.readLines(); } readFile(rootFileSystem.resolve(&quot;&#x2F;app&#x2F;data&quot;)); </code></pre> Can you do it? Yes. Does it make code that was once concise and obvious verbose and non-obvious? Also yes.<p>Consider also the pain that occurs when you need a module that has higher privileges than the code calling it (e.g. a graphics library that needs to load native code, but you don&#x27;t want to let the sandboxed code do that). In the pure caps model you end up needing a master process that &quot;tunnels&quot; powerful caps through to the lower layers of the system, breaking abstractions all over the place.<p>Secondly, this model means you can never add new permissions, change the permissions model or have different approaches because refining permissions == refactoring all your code, globally, which isn&#x27;t feasible.<p>Thirdly, this model imposes cap management costs on <i>everyone</i> even if they don&#x27;t care about security because they know the code is trustworthy e.g. because their colleagues wrote it, it came from a trustworthy vendor, or because it&#x27;ll run in a process sandbox. Even if you know the code is good it doesn&#x27;t matter, you still have to supply it with lots of capabilities, you still have to implement callbacks to give it the capabilities it needs on demand and so on.<p>These problems caused Java to adopt a mixed capability&#x2F;ambient permissions model. In the SecurityManager approach you assigned permissions based on <i>where</i> code came from and stack walks were used to intersect all the sources on the stack. Java also allowed libraries to bundle data files within them, and granted libraries read access to their resources by default. That solved the above problems but introduced new ones, in particular, it lowered performance due to the stack walking, plus now library developers had to document what permissions they needed and actually test the code in a sandboxed context. They never did this. Also the approach was beaten from time to time by people finding clever ways to construct pseudo-interpreters out of highly dynamic code, such that malicious code could get run without the bad guy being on the stack at all.<p>Fourthly, it&#x27;s dependent on everyone playing defense all the time. If your object might get passed in to malicious code, then it has to be designed with that in mind. A classic mistake:<p><pre><code> class Foo { private ArrayList&lt;String&gt; commands; void addCommand(String command) { commands.add(command); } List&lt;String&gt; getCommands() { return commands; } } </code></pre> The author&#x27;s intent was to make an object in which you can read the list of commands but not write them. But, they&#x27;re returning the collection directly instead of using an immutable wrapper. Fine in normal code, but oops, in sandboxed code now you have a CVE. Bugs like this are non obvious and the tooling needed to find them isn&#x27;t straightforward. These bugs are a drain on development.<p>Fifthly, Spectre attacks mean that a library that can get data to an attacker via any route can exfiltrate data from anywhere in the process. You may not care about this, and for many libraries there may be no plausible way they can exfiltrate data. But it&#x27;s another sharp edge.<p>Finally, it all depends on the ecosystem having minimal native code dependencies. The moment you have native code in the mix, you can&#x27;t do this kind of sandboxing at all.<p>Now. All these are <i>challenges</i> but they don&#x27;t mean it&#x27;s impossible. Sandboxing of libraries is clearly and obviously where we have to go as an industry. The Java approach didn&#x27;t fail only due to the fundamental difficulties outlined above - the SecurityManager was poorly documented and not well tuned for the malicious libraries use case, because it was really meant for applets. After the industry gave the Java team so much shit over that, they just sort of gave up on the whole technology rather than continuing to iterate on it. It may be that a team with fresh eyes and fresh enthusiasm can figure out solutions for the above issues and make in-process sandboxing really happen. I wish them the best, but anyone who wants to work on that should start by spending time understanding the SecurityManager architecture and how it ended up the way it did.<p><a href="https:&#x2F;&#x2F;dl.acm.org&#x2F;doi&#x2F;pdf&#x2F;10.1145&#x2F;2030256.2034639" rel="nofollow">https:&#x2F;&#x2F;dl.acm.org&#x2F;doi&#x2F;pdf&#x2F;10.1145&#x2F;2030256.2034639</a>
评论 #30989698 未加载
评论 #30992136 未加载
Hackbraten大约 3 年前
Vanilla JS is not something we should be afraid of. I wish we’d consider it more often in projects.<p>The latest generations, ES2020 and newer, are pretty useful and pleasant to use. If you leverage their features, it goes a long way. Implementing the odd missing function yourself along the way is perfectly doable if you embrace TDD.<p>My feeling is that people in the JS ecosystem tend to overestimate how much time they’d allegedly waste re-implementing stuff, and grossly underestimate the true cost of deeply-nested dependency trees.
cosmiccatnap大约 3 年前
Sort of a cake and eat it too mentality if you ask me. If you&#x27;re not willing to build your own JS glue then you should at least take time to audit the glue you are pulling in from some thankless developer who probably started this as a hobby project in college and now it is the backbone of 10 fortune 500 frontends.<p>I&#x27;m sorry that they can then do whatever the hell they want with that package but this ecosystem exists because companies want free stuff but don&#x27;t want to provide back into it.
numbsafari大约 3 年前
If, instead of loading library code directly into the same process and heap, package code were instead loaded and run in their own dedicated processes with their own dedicated memory and you communicated via message passing (a la actors) then this approach would really start to make sense.<p>But most node packages today are designed to run directly in the same process and memory space as the code that is being imported.<p>Also, any package manager that runs arbitrary code should not be trusted.
tlhunter大约 3 年前
I was once part of a startup named Intrinsic. We had built out a complex product that protected Node.js processes with extreme granularity. Not much information exists about the product after it was acquired but the blog posts are still up:<p><a href="https:&#x2F;&#x2F;medium.com&#x2F;intrinsic-blog&#x2F;securing-node-js-applications-with-intrinsic-db47ff86cff8" rel="nofollow">https:&#x2F;&#x2F;medium.com&#x2F;intrinsic-blog&#x2F;securing-node-js-applicati...</a>
cryptonector大约 3 年前
&gt; A modest proposal<p>&gt; It seems .. frankly, solvable.<p>I don&#x27;t think TFA understands the reference.<p>&gt; Capabilities to the rescue<p>And that&#x27;s the summary of TFA: sandbox everything!<p>Except there&#x27;s always sandbox escapes. OK, those are harder, so sandboxing more is a start, for sure.<p>There&#x27;s no panacea here. Dependencies are costly. Open coding is costly. Curating external source and packages is costly. It&#x27;s all costly. We need to recognize a lot of these costs.
jamesfisher大约 3 年前
I almost didn&#x27;t read this because the title sounds like a whingeing rant. But it turned out to be a carefully considered proposed solution.
havkom大约 3 年前
I would suggest that one tries to limit dependancies. The entire node ecosystem contraviene this so maybe people should not use it.
fabioferrari大约 3 年前
We are distributing trust in a too thin way. Node packages should be grouped in superset packages with a concentrated trust on special maintainers. Makes no sense to upgrade a lot of small packages each time we do a &quot;npm update&quot;.
jcmontx大约 3 年前
I remember reading articles like this since 2016 or 2017. How come nothing has changed in so many years? Is this issue not important enough? Or is the solution just to expensive&#x2F;unpractical to implement?
评论 #30989966 未加载
andrewmcwatters大约 3 年前
I made another post here, but in a separate note, some of the developers of the most used software in the Node.js ecosystem, as people, don’t deserve your trust either.<p>For the past decade or more I’ve watched and personally interacted with the personalities of some of these developers and the last thing they seem to have on their mind is the stability of your software. They just do not care.<p>Many of them are totally willing to throw away years of work that you also built years of work on for you to chase after their new toy.<p>These are guys that built popular packages in their early to mid 20s. They weren’t thinking about software that lasts any meaningful duration of time.
a9h74j大约 3 年前
Is there a need for ... <i>NPM: The Good Parts</i>
评论 #30989672 未加载
mc4ndr3大约 3 年前
Got tired of constantly being the one to patch upstream problems, ended up deprecating the majority of my (alt)JS problems.
chubot大约 3 年前
I think this needs to be solved at the OS level, not the language level.<p>It&#x27;s a problem for every language -- packages you download can write to any file or make network connections. It might be a little worse in NPM because of the culture, but the problem is pervasive.<p>Personally I&#x27;m interested in the direction of lightweight containers that behave like executables, and that have composable dependencies. Developing in Docker-like containers can work but there are a bunch of downsides to be mitigated.<p>(copy of lobste.rs comment)
nilsbunger大约 3 年前
I&#x27;m surprised we haven&#x27;t had many crypto key thefts via npm supply chain exploits.
newusertoday大约 3 年前
what is the solution for people who want to use it for frontend only?just importing js libraries that will only need to work on browser so no access to system resources without nodejs or browser? any ideas?
z3t4大约 3 年前
There are only two solutions: 1) Trust someone 2) Carefully read through their changes<p>node_modules should be banned from .gitignore<p>npm should stop moving folders around. If I have placed a module in node_modules&#x2F;foo&#x2F;bar it should stay there! Not get moved to node_modules&#x2F;foo@1.0.0 etc
评论 #30989586 未加载
grnmamba大约 3 年前
The offending event-source-polyfill version is still on npmjs.com.
jFriedensreich大约 3 年前
there is already a project that does most of this: deno. there are of course other motivations that differentiate it from nodejs but i think this should be part of a new runtime that was build with this in mind, deno is the way forward. Of course putting your projects in appropriate jails&#x2F;zones&#x2F;containers&#x2F;vms is also an option, but that has always been true
ecmascript大约 3 年前
I don&#x27;t get why this happens to node all the time. They have a very extensive code of conduct that forbids this &#x2F;s
j0057大约 3 年前
Capabilities, chroots and whatnot look like containers, but with extra steps.
jollybean大约 3 年前
Systems not designed for security are hard to secure after the fact.
marcus_cemes大约 3 年前
It makes me deeply sad to see these sort of interactions in open source [1].<p>&gt; Hmm, I think it&#x27;s a worthwhile fix. Where did you see malware here?<p>&gt; I think the author of this repo is free to decide what code he publishes. Say thanks to that it&#x27;s for free<p>An incredible amount of people have dedicated sweat and tears and foreheads (from banging against the desk in frustration) to open source across the entire stack, from the contributers to OSs such as Linux to those working their arses off to create better frameworks, languages and runtimes, that we can <i>all</i> benefit from and use with a reasonable expectation of security, respect and privacy.<p>As a university student, I feel privileged to have been able to grow up in a world where so much work and knowledge is provided for free with no strings attached, regardless of demographic&#x2F;location, I would not be where I am without it. A century ago this would not have been possible. To all of you who have tirelessly and selflessly worked on OSS for others, without expecting anything in return or imposing politics, ideologies, infringing on privacy, causing damage, collecting vast quantities of marketable personal information or monopolisation, I give you my heartfelt thanks for your efforts, you know who you are. You have created something that will have forever helped to improve our society and empower those that want to learn and create their own designs.<p>From my own personal experience, I want to give a shout-out to the smaller projects of Rust, Svelte and Elixir. I think it&#x27;s incredible that the work and ideas of (often) a single person (Rich Harris, José Valim) can grow into larger extremely welcoming and helpful communities with many more motivated contributors that are proud of being parts of those projets and put in an extraordinary effort to try and do things <i>better</i> than before. I&#x27;m sure there are plently of other worthy names I&#x27;m too young&#x2F;ignorant to know.<p>Love it or hate it, Node.js has been very empowering for a large number of people to learn and publish their own full-stack applications, the JavaScript ecosystem has improved enormously since its beginnings, but has a tendancy to change slowly due to its size, unless a disruptive technology comes along such as TypeScript. Websites are a great way to introduce people to the joy of programming with its visual feedback, you can make a small penguin move across the screen, then move on to play tic tac toe. Even as a younger developer, I admit that the days of FTP, no-build-step pages with a sprinkle of JQuery were easier to understand and actually <i>safer</i> for newcomers than introducing someone to a SPA stack (which can easily have thousands of transient dependencies) nowadays.<p>[1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;Yaffle&#x2F;EventSource&#x2F;issues&#x2F;202" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Yaffle&#x2F;EventSource&#x2F;issues&#x2F;202</a>
vlunkr大约 3 年前
Pasting a comment I made about this a while ago:<p>The reason this keeps happening with NPM is because of absurd number of dependencies in the average node app. I have a tiny app I&#x27;ve been playing with using create-react-app. There are over 800 directories in node_modules. That absolutely dwarfs the number of any other language I&#x27;ve used. Even in a medium sized rails app, you likely have some awareness of what every dependency is. It&#x27;s just impossible with npm.<p>This makes it easier for someone to inject their package into the ecosystem whether it&#x27;s actually very useful of not (like the colors package).<p>One thought I&#x27;ve had to &quot;reboot&quot; the npm culture is to somehow curate packages that are proven to have minimal and safe dependencies, probably through manual review. Maybe it could be recursive, so that safe projects only rely on other safe projects.
评论 #30989018 未加载
评论 #30988697 未加载
评论 #30988950 未加载
评论 #30989427 未加载
评论 #30989450 未加载
评论 #30989343 未加载
评论 #30989408 未加载