Re:How to build an NPM worm
by golangnews on Friday July 13, 2018 @01:40AM
(#17520744)
Importing lots of code from others is a path towards bugs and mistakes. You end up not understanding your dependencies, importing far too much (because you want function x but also get a-z), amd dealing with changes you didn't want or need which mix security fixes with features.
Better to minimise dependencies particularly for trivial functions. Not just for security but for ease of development.
I love node - it's a really irresponsible way of programming. The objective is to make as much the concern of someone else as possible. "How do I know what an array is? I'm just writing this app that works with arrays.."
:-)
In seriousness though, there many ways to write an isArray. Just yesterday I was looking at the different things String::repeat() handles on Mozilla's site. What seems trivial can be defined slightly differently everywhere and I tend to reach into the npm bag if I know it's open to interpretation.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Ignoring the obvious stupidity here, why does it invoke Ruby only to invoke curl?That's not what it's doing. It's downloading Ruby code and then running it. The "$(...)" is evaluated first.
It curls the install script, which is passed to ruby as a string which is run.
Ah, duh, you're right. I forgot $() is bash syntax and not the Ruby syntax for running an external command. Thanks, and yikes.
Re:How to build an NPM worm
by analogmemory on Friday July 13, 2018 @01:02AM
(#17520636)
Because the install script is in ruby?
Perhaps npm packages should be dockerised to prevent this.
Re:How to build an NPM worm
by madeofpalk on Friday July 13, 2018 @11:51AM
(#17523979)
> from THE MASTER BRANCH
to be fair, there's nothing particular about the branch called 'master'.
Re:How to build an NPM worm
by mcintyre1994 on Saturday July 14, 2018 @02:38AM
(#17529147)
The point is that you just have to engineer your way to commit access on master once. If it at least pointed to a github release or an immutable equivalent, it'd be vetted by the author before millions of people point a ruby eval at it.
Ultimately though, the goal needs to be to build tools where its hard to do something insecure regardless of how we otherwise feel about that programming practice. It can't be that the reason we shouldn't install is-array is because it can lead to catastrophic exploits -- that says something about the ecosystem not the validity of where we choose to draw the line of what merits a library.
Node is cursed in part by its success. In a lot of ways its like the early days of the web, it grew faster than we had time to figure stuff out in. That's OK if we learn quickly and adjust accordingly. We don't have to run node program's with access to everything -- but again, we don't have to run any kind of program with access to everything. Go to Homebrew's website (https://brew.sh). This is a developer tool and what they tell you to do is to blindingly copy a bash line that downloads a file from THE MASTER BRANCH on GitHub and runs it on your system:
Get access to this guy's password and you can compromise tons of systems too. As much as I hate the Mac App Store as a distribution mechanism, there's something to the "sandbox first" programming mentality it incidentally forces its apps into. Maybe we should be thinking more along those lines too.