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

I compiled a list of NPM best practices one can adopt to reduce supply chain attack risks (even if there's no perfect security preventions, _always_): https://github.com/bodadotsh/npm-security-best-practices

Discussion on HN last time: https://news.ycombinator.com/item?id=45326754


For anyone publishing packages for others to use: please don't pin exact dependency versions. Doing so requires all your users to set "overrides" in their own package.json when your dependencies have vulnerabilities.


I have a shorter list of NPM best practices:

1. Don't


Do you know of anything similar for pip?


No.1: Run untrusted code in a sandbox! https://github.com/sandbox-utils/sandbox-venv


Most of the best practices can be translated to python ecosystem. It’s not exact 1:1 mapping but change few key terms and tools, the underlying practices should be the same.

Or copy that repo’s markdown into an llm and ask it to map to the pip ecosystem


Yeah, was mostly interested in the tooling.


shamless plug but here's a list of things you could follow to mitigate risks from npm: https://github.com/bodadotsh/npm-security-best-practices


The lockfile is updated _after_ any new malicious version is downloaded and installed. If we pinned the exact version, `npm install` will _not_ download and execute any new published versions.

That's why we use `npm ci` or `--frozen-lockfile` to install the exactly versions as lockfiles. But, by default, the `^` operator and just `install` command will check registry for any new releases and download them.

The primary arguments against pinning versions are missing security updates and increased maintenance overhead. But given the patterns we've seen, the attackers really _hope_ we automatically install new releases


npm install does install the exact versions from the lockfile. Even though this misconception gets repeated in every single thread about npm here on hn. npm install will not randomly update your direct dependencies, let alone transitive dependencies.


I also built https://lessnews.dev (HN filtered by webdev links)

One decision I had to make was whether the site should update in real time or be curated only. Eventually, I chose the latter because my personal goal is not to read every new link, but to read a few and understand them well.


I’ve also been experimenting with a curated webdev related newsfeed based on HN submissions: lessnews.dev The goal is not to keep users on the site. If some dev visit the site once in a while, and finds a link useful, that’s it.


Second Tuta. Their feature list might be limited when compared to Proton or Fastmail, but their core email service is solid.


Orion on YouTube is unusable at the moment. Click play, ad plays 1 second, disappears but then nothing else plays. Click again, another ad briefly appears and disappears. Have to resort back to Firefox with uBlock Origin just to watch YouTube


Yeah, seeing this one too. Is it an Orion or Safari thing though?


nicely done, and while we on the topic of doomscrolling, maybe there's a surge of anti-doomscrolling trends coming soon? I know I built lessnews.dev to overcome my urge to mindlessly scroll HN all day.


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

Search: