Hacker Newsnew | past | comments | ask | show | jobs | submit | nepthar's commentslogin

I agree. Take what ya can, give nothing back!

I just took a look a both (thanks for the pointer to seastar! cool project). I'd say "sort of but not exactly". It seems like two approaches to solving the same problem.

Silk seems like mostly a scheduler that uses C++'s native coroutines. Seastar is a future-based framework. Both contain a scheduler and enable async coding patterns.


“No way to prevent this” says only package manager where this regularly happens.


Is there anything about npm that makes it particularly susceptible to these attacks, other than the fact that it's the most popular package manager of all?


It's the general ecosystem.

There's not a word in the English language that really expresses how absolutely stupid the npm ecosystem is and the developers that perpetuate it by importing a package rather than writing 5 lines of code.


npm can execute code after install and most package managers don't do that


I'm far from an expert, but this feels like an oversimplification.

Python packages traditionally use setup.py to install code, and setup.py is all executable code under the installed package's control.

Native Ruby Gems execute arbitrary code via extconf.rb.

Pre .NET Core, NuGet packages could ship scripts like `install.ps1`. That's been removed, but they can still ship `.targets` and `.props` files that are incorporated into your build (and so can run code at build time).

PHP Composer packages can ship install scripts or configure themselves as Composer plugins.

The venerable .tar.gz approach to packaging, covering decades of C and C++ code, is all about executing code during installation.

There are measures that can help (e.g., PHP Composer doesn't run install scripts of _transitive_ dependencies) but the JS space is adopting measures that can help too (like pnpm's approve-builds).


> Python packages traditionally use setup.py

But nowadays prefer pyproject.toml, and most people use pre-built distributions (wheels) for their architecture from PyPI, so don't execute arbitrary code to install packages.

> PHP Composer packages can ship install scripts

Which requires the user to say yes to running them, but they can also say they only want a specific package to run scripts with something like "composer -n config allow-plugins.foo/bar true && composer -n require foo/bar"

> The venerable .tar.gz approach to packaging

Which most people don't install directly, but have already had built for them by their distro.

As more and more languages get "package managers", there's an expectation that installing what should just be inert package/library code should not run commands. Sometimes generated files are needed, and the direction seems to be that these package managers should be like distro package managers, where they take the risk of running the build instructions and generate those files for you, serving up os/architecture-specific builds.

This is the direction npm ought to take, and furthermore shouldn't allow things like electron being a small bundle of javascript code that fetches large lumps of binary code from somewhere else on the internet to install. It should all be uploaded to, and sourced from, NPM.


> But nowadays prefer pyproject.toml, and most people use pre-built distributions (wheels) for their architecture from PyPI, so don't execute arbitrary code to install packages.

Yes, and these are positive changes. But they aren't security boundaries, and they don't mean that pip won't execute arbitrary code: a malicious update could ship an update with sdist instead of wheels, a malicious pyproject.toml could provide an arbitrary-code `build-backend`, etc., and pip would still function as designed.

I appreciate the clarifications/corrections on PHP.

> Which most people don't install directly, but have already had built for them by their distro.

Yes, but the original claim was that npm is "particularly susceptible to these attacks" because "npm can execute code after install and most package managers don't do that." I don't think that's accurate: we've seen hundreds of NPM packages compromised in multiple high-profile attacks over the last several months, while .tar.gz was used for decades with nowhere near the same number of compromises.

Rather, I suspect it's a combination of factors: Early JS had a relatively anemic standard library in the early days, and NPM made code reuse dramatically simpler than before. This normalized the use of large and deep dependency trees among JS projects. And the extreme popularity of JS, the centralization of NPM + GitHub, and increased usage of automation makes attacks more practical and more lucrative.

Taking a step back from that particular debate, I'm very much in favor of changes like what you describe.

Taking still another step back, I'm not sure that even those will be enough. If I download a package, it's because I intend to run its code at some point: if it's malicious, I may be less automatically hosed than if its postinstall script runs, but I'm still hosed at execution time. I trust my distro packages, not because they don't execute arbitrary code on installation (RPMs and .debs both do), but because I _trust my distro_. NPM et al. simply cannot vouch for every package they host.

Thanks for the reply!


> Early JS had a relatively anemic standard library in the early days, and NPM made code reuse dramatically simpler than before. This normalized the use of large and deep dependency trees among JS projects.

This always seems like a very convenient excuse. C also have a very small standard library. And unless you're doing system programming, you often have to find utility library. It's just that those libraries tries to solve their domain instead of splitting themselves into molecules. Before npm, we had good js libraries too like jQuery as a fundamental one, backbone.js, dropzone.js,... where you import a few files (and vendor them in your project) and be done with it.

The issue with NPM is that it led to the creation of weird ecosystem like babel, webpack, eslint,... where instead of having a good enough solution, it was plugins ad infinitum. And other maintainers started doing the same thing, splitting their libraries, and writing libraries where a gist or a blog post would be enough[0]. Cargo is suffering the same[1]

[0]: https://github.com/Rob--W/proxy-from-env/blob/master/index.j...

[1]: https://docs.rs/is_executable/latest/src/is_executable/lib.r...


The whole JS ecosystem is insane. ESM, CJS, are still, and will be issues for the next 5-10 years.


> But nowadays prefer pyproject.toml

Couldn't you accomplish the same thing by adding a malicious [build-system] to a pyproject.toml file? You can pull in arbitrary code by providing exact URLs for requirements:

  [build-system]
  requires = ["hatchling @ https://files.pythonhosted.org/packages/8f/8a/cc1debe3514da292094f1c3a700e4ca25442489731ef7c0814358816bb03/hatchling-1.27.0.tar.gz"]
  build-backend = "hatchling.build"


That's a very visible Ken Thompson style attack. The modern expectation is that PyPI would be evaluating this build-system section and would only accept build-systems that they trust to turn package distributions into wheels, and the end users only need the wheels. If you need a specific version of hatchling that they know of, that's fine. If you need something they haven't heard of, they should say no.


> most people use pre-built distributions (wheels) for their architecture from PyPI, so don't execute arbitrary code to install packages

Technically true, but wheels can include a `.pth` which will run arbitrary code as soon as Python is started, which is only marginally less dangerous. Recently exploited in the LiteLLM attack.


That appears to be an exploitable feature of the language, not the package manager per se.

We could then add the philosophical question of asking what's the difference between:

1. Adding malicious code to a package's .pth file that's evaluated automatically on every python invocation

2. Adding malicious code to the package itself that's evaluated automatically on every python invocation _that uses that package_

Packaging systems that don't run arbitrary code when you install a package are more trustworthy than ones that do, but there's still the essential trust you have to place in all code you're installing, directly and indirectly.


/me looks at the `build.rs` file in my Rust's project's `Cargo.toml` and laughs nervously...

(For non Rustaceans: "Placing a file named build.rs in the root of a package will cause Cargo to compile that script and execute it just before building the package.")


aaand many Cargo packages do use it, right now. It became an inseparable part of Rust ecosystem. You cannot build any embedded program or something slightly complex (omg Protobufs!) without build.rs. Not just your own program but all of your dependencies' build.rs is also executed.

I get the need for simple ways to make ecosystem inviting to the new developers. However, I think Cargo was completely mis-designed for simplicity only, where a system language like Rust should shine in its ability to control complexity. With the bad initial design, they invented hacky solutions like build.rs which speaks a string-based language to talk with Cargo!

On top of that crates.io is completely ripe for typosquatting and package overtakes. I think the ecosystem should be completely revamped to a Maven-style namespaced repos and it should require strong GPG signatures.


You're installing code from npm anyway, presumably to execute it at some point on some machine. If it's will be executed from an install script or later during app execution should not really make much of a difference for most devs.


Most of them definitely let you do that.


Yep.

1. Every day there's a new package.

2. Then five more packages appear so you don't have to write that one terrifying line of JavaScript yourself.

3. Then someone writes a wrapper around those five packages.

4. Then someone writes a "modern, lightweight, zero-config" wrapper around the wrapper.

5. Then a framework adopts it, a build tool requires it, and suddenly your todo app has a dependency graph that looks like international diplomacy.

6. Out of 100 devs building the same product, there are now 300 different dependency combinations, all somehow involving 'left-pad' spiritually if not literally.

7. Half the packages are maintained by one person, unpaid, at 2 a.m., after getting yelled at in GitHub issues.

8. The other half were abandoned three years ago but still have 40 million weekly downloads because removing them would break civilization.

9. Pinning dependencies sounds nice until the ecosystem tells you, "sorry, this package only works with Node 22, this plugin needs Node 18, and this transitive dependency has discovered ESM enlightenment."

10. So everyone lives on the bleeding edge, except nobody agrees where the edge is, and the bleeding part is very real.

So yeah, npm is not uniquely cursed because JavaScript devs are worse. It's cursed because it turned code reuse into a lifestyle, dependency trees into rainforests, and 'npm install' into an act of faith.


> 7. Half the packages are maintained by one person, unpaid, at 2 a.m., after getting yelled at in GitHub issues.

By a manager for for a >$1 billion market cap corporation who doesnt understand that the one person isnt an employee.


Pangram says this comment is %100 LLM generated.

It certainly reads as LLM generated!


It was.. but not in the way people generally think. Im not a native english speaker. Therefore, I use chatgpt to fix my comment sometimes. This was done the same way.


I get it and I'm not trying to get down on you, but I've seen people around say this and it bugs me.

I don't know Japanese at all. Sometimes I use LLMs to translate discord messages into Japanese so I can communicate with Japanese people. Then as verification I translate the messages back (with different LLMs) and they usually come out as a near-verbatim version of what I wanted to say. In other words, they don't come out in the chatgpt style of writing.

If I'm able to do that, then chatgpt should be able to fix your English without chatgpt-ifying the whole comment.


Point accepted. But,

If there are people who focus more on chatgpt "style" of writing, rather than what the message is conveying, frankly, I don't care.

These things are here, they are here to say, and expand into a lot more domains.


No. NPM's not particularly bad at all tbh.


OWNED BY MICROSOFT


Well, I too, don't have anything against a company selling a "good but not open printer", and I don't care if my fridge is open.

However, I hope you see that the behavior reported by Jeff here is just bad. They are either not understanding open source licenses or are acting in bad faith.


I think this might be rage bait.


Friendly reminder to take a look at our posting guidelines, found at the bottom of the page.

What specifically did you find dumb about this?


I had one of these. My account ended up eventually being reinstated. No reason was given for the initial account freeze or reinstating.

One thing I did - in response to them saying I could no longer do business, I told them that they also could no longer do business with me, requested a copy of all of the user data they had on me under CCPA, and told them to then delete all of my personal information. They did not actually comply and I didn't pursue. I probably should, though.


Yeah, this is the single biggest reason I avoid go - I just don't want to clutter my "happy path" logic. It makes things harder to reason about.

"Errors are values", sure. Numbers are values and Lists are values. I use them differently, though.

I wonder if there could be "stupid" preprocessing step where I could unclutter go code, where you'd make a new token like "?=", that got replaced before compile time. For instance, "x ?= function.call();" would expand to "x, err := function.call(); if (err != nil) return err;"


There's no happy path in programming. Errors are just some of the many states in the code and the transition to them doesn't disappear magically because you chose to not specify them. Actually returning an error is just a choice, you can chose to handle the situation, maybe log the error and go on your merry way. Or you panic() and cancel the whole call stack back to a recover(). I like Go because it forces you to be explicit.


There absolutely is a happy path in programming - what you want the code to do, assuming no errors. It's the intent of the code and that surely is an important thing for the code to express.


Is there really such a large crossover that climbing.com makes it to hacker news? Sure, this is interesting, but I love that this site is focused on tech.


Anecdotally the climbing gym is the only semi-public place in which I've walked past someone browsing HN; without material stats I would still guess developers and people in tech vastly outnumber other fields among climbing gym members.


Planet Granite Sunnyvale was my haunt when I lived in CA. Almost everybody it seemed were wearing tshirts with the same logos you see driving down 101, in those days (10 years ago before that was uncool).


"On-Topic: Anything that good hackers would find interesting. That includes more than hacking and startups. If you had to reduce it to a sentence, the answer might be: anything that gratifies one's intellectual curiosity."

https://news.ycombinator.com/newsguidelines.html


A lot of devs love climbing. Problem solving is part of it, especially if you climb a route for the first time. Very different area but similar approaches need to be deployed to succeed.

Plus its properly great and fulfilling activity that very few sports can deliver (IMHO), not requiring massive investment or some ridiculously long and difficult trips to just get to it (gyms, if you want to climb in Patagonia or Antarctic then its a different game altogether).


The headline is about the guy who created new procedures and standardization. Those are certainly technologies by many definitions. The article talks about how he created a lot of what we consider the modern climbing gym. Fitness innovations are also a form of technology.

Hacker news never claimed to be exclusively about digital technology, or electronic technology.

This is an article telling the story of someone passionate about creating something new and innovative. Seems pretty aligned to me?


Weekend HN is a different vibe. Much lower bar to hit the front page. Maybe because everyone is out climbing instead of reading HN.


Climbing, especially bouldering, requires solo problem solving. It’s the closest thing to coding in athletic terms.


That could be said about a variety of athletic endeavors. Mountain biking comes immediately to mind.


That’s an excellent point


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: