4 ms·
Edit: I'm definitely wrong. The person who published these was merely parking the packages. Leaving the existing (inaccurate, see response) message as one examp
by zamalek 11y ago
Edit: I'm definitely wrong. The person who published these was merely parking the packages. Leaving the existing (inaccurate, see response) message as one example of how badly this could have turned out.
> and the content of the files is suspicious
The script seems as though it might publish your entire codebase to NPM. Sorting NPM packages by creation date[1] reveals[2] a[3] few[4] potential victims. Filtering by the ISC license also seems to work.
[1]: https://libraries.io/search?order=desc&platforms=NPM&sort=created_at https://libraries.io/search?order=desc&platforms=NPM&sort=cr...
[2]: https://libraries.io/npm/alaska-dev https://libraries.io/npm/alaska-dev - internally hosted repo, edit: license doesn't match other projects by the same developer
[3]: https://libraries.io/npm/b3app-prototype https://libraries.io/npm/b3app-prototype - private bitbucket repo, edit: deleted from npmjs
[4]: https://libraries.io/npm/nodework https://libraries.io/npm/nodework - private bitbucket repo
- zwily 11y agoInstalling one of these packages doesn't execute the script though, you'd have to do that yourself. (It could be updated to do that though, which is terrifying.)
- zamalek 11y agoI wonder if the author is possibly proving a point. Regardless, it seems as though having an NPM user set up on your CI server is a big risk.
- NathanKP 11y agoYou have to have an NPM user setup on your CI server in order to use private NPM packages, which some companies do instead of hosting their own onsite NPM.
- SlashmanX 11y agoWell there is pre/post install scripts that can be run. Not saying this package does that, but it is very easy to run a script just after installing from npm
- doublerebel 11y agoYes, npm will publish any package.json without `private: true` set, and will publish all files in the current directory by default (anything not listed in .gitignore or .npmignore). There is a great CLI tool called "irish-pub" I use, it shows a publish dry-run to avoid these simple mistakes.
- fapjacks 11y agoGreat suggestion, thanks!
- deleted 11y ago[deleted]
- nmjohn 11y agox.sh was just the script I used to automatically register all the packages. It takes one argument, a package name, then attempts to publish that package. So cat list | xargs -I{} ./x {} was what I used to publish the whole list.
- zamalek 11y agoIt seems as though, unintentionally, you've found a pretty big vulnerability. Either way, kudos for parking these packages until they find a new home - this could have turned out so much worse.
- drinchev 11y agoHey really sorry for what happened. Anyway did you think of explaining your intend to doing so? I've been doing development for years and I've never seen a developer naming files "x.sh", except if it was not malicious.