News for hackers. Stuff that matters.
Re:Postmortem: TanStack npm supply-chain compromise by chrisweekly on Monday May 11, 2026 @06:18PM (#48101453)
Postinstall scripts are deadly. Everyone should be using pnpm.

Crazy that an "orphan" commit pushed to a FORK(!) could trigger this (in npm clients). IMO GitHub deserves much of the blame here. A malicious fork's commits are reachable via GitHub's shared object storage at a URI indistinguishable from the legit repo. That is absolutely bonkers.

Re:Postmortem: TanStack npm supply-chain compromise by fabian2k on Monday May 11, 2026 @06:21PM (#48101483)
Once you run your app with the updated dependencies, that code is executed anyway. And root or non-root doesn't matter, the important stuff is available as the user running the application anyway.
Re:Postmortem: TanStack npm supply-chain compromise by yetanotherjosh on Monday May 11, 2026 @07:33PM (#48102206)
How is this not a Github P0? Can anyone explain?

When I read that, I thought they must be using 'fork' wrong, and actually mean branch on the official repo, as that can't be right!?" Good lord.

Re:Postmortem: TanStack npm supply-chain compromise by ZeWaka on Monday May 11, 2026 @07:41PM (#48102280)
they probably used the publish token in a pull-request-target workflow or something?
Re:Postmortem: TanStack npm supply-chain compromise by ghost_pepper on Monday May 11, 2026 @08:05PM (#48102446)
yes, they used pull_request_target for a benchmarking suite. github has a huge warning saying to never use pull_request_target to run user code, but this is just going to keep happening
Re:Postmortem: TanStack npm supply-chain compromise by riknos314 on Monday May 11, 2026 @09:07PM (#48102924)
> github has a huge warning saying to never use pull_request_target to run user code

This is an area where documentation is necessary but not sufficient. Github needs to add some form of automated screening mechanism to either prevent this usage, or at the very least quickly flag usages that might be dangerous.

Re:Postmortem: TanStack npm supply-chain compromise by hombre_fatal on Tuesday May 12, 2026 @07:42AM (#48106870)
"pull_request_target" vs "pull_request" is also bad naming. At least give it a dangerous name so people know there's a dangerous quirk to it when reading their config.
Re:Postmortem: TanStack npm supply-chain compromise by qudat on Monday May 11, 2026 @11:10PM (#48103742)
And a labeling action which requires `pull_request_target`: https://github.com/actions/labeler#create-workflow

These types of features are not worth it and need to be removed from the marketplace.

Re:Postmortem: TanStack npm supply-chain compromise by edelbitter on Tuesday May 12, 2026 @12:13AM (#48104117)
If git in general would enforce pretending to not know about orphans, it would always need to know what you were meaning to consider the boundary, and/or you would end up waiting for useless duplicate network traffic. The fact that on GitHub, such references are visible irrespective of specified repo is not a bug, its a feature. Its the tools (including but not limited to: GitHub Actions) that cause dangerous misunderstanding in appearing to let you specify something they then never actually enforce.

specified: repo location, slightly-difficult-to-preimage hash

intended meaning: use this hash if and only if it is accessible from the default branch of that repo

actual meaning: use this hash. start looking at this location. I do not care whether it is accessible through that location by accident, by intent of merely its uploader, or by explicit and persisting intent of someone with write access to the location.

Re:Postmortem: TanStack npm supply-chain compromise by sheept on Tuesday May 12, 2026 @01:36AM (#48104578)
In some cases, you can also use forks to read commits from private forks[0], but GitHub considers these linked commit networks working as intended.

[0]: https://trufflesecurity.com/blog/anyone-can-access-deleted-a...

Re:Postmortem: TanStack npm supply-chain compromise by sozforex on Tuesday May 12, 2026 @03:23AM (#48105261)
This is a very worthy article. I have an impression that I've read it before 2024, but maybe that was a different article describing the same mess with how github exposes private repos.
Re:Postmortem: TanStack npm supply-chain compromise by cedws on Tuesday May 12, 2026 @03:42AM (#48105372)
Because GitHub only cares about AI.
Re:Postmortem: TanStack npm supply-chain compromise by eviks on Tuesday May 12, 2026 @03:57AM (#48105468)
And maintaining high level of service availability!
Re:Postmortem: TanStack npm supply-chain compromise by rvz on Tuesday May 12, 2026 @06:02AM (#48106183)
With zero down time!
Re:Postmortem: TanStack npm supply-chain compromise by jonchurch_ on Monday May 11, 2026 @09:00PM (#48102883)
The compromised action here was using pnpm.

They poisoned the github action cache, which was caching the pnpm store. The chain required pull_request_target on the job to check bundle size, which had cache access and poisoned the main repo’s cache

The malicious package that was publisjed will compromise local machines its installed in via the prepare script, though.

Re:Postmortem: TanStack npm supply-chain compromise by corvad on Monday May 11, 2026 @11:46PM (#48103970)
Yes, but the exploit was with Github Actions not something that pnpm really prevented.
Re:Postmortem: TanStack npm supply-chain compromise by maxloh on Tuesday May 12, 2026 @02:23AM (#48104876)
I think it was an afterthought in the design. CI cache should be scoped per-user, or at least per-group.

If a workflow run by a maintainer (with access to secrets) can pull a cache tarball uploaded by a random user on GitHub, then it’s a security black hole. More incidents like this are inevitable.

Re:Postmortem: TanStack npm supply-chain compromise by ricardobeat on Tuesday May 12, 2026 @04:27AM (#48105661)
Those are two different attack vectors. The exploit they used on Github Actions would work for either npm or pnpm. But the replication part using postinstall scripts, once it is installed on another machine, would be stopped by pnpm.

What I'm curious about is: how can you poison the cache in CI, if the lockfile has an integrity hash for each package?

Did the incoming PR modify pnpm-lock.yaml? If so, that would an obvious thing to disallow in any open-source project and require maintainer oversight.

Re:Postmortem: TanStack npm supply-chain compromise by Yokohiii on Tuesday May 12, 2026 @08:21AM (#48107223)
From what I understand they've wrote the poisoned payload directly to the file system where they've expected another package exists. You only need to know what hash is going to be created.
Re:Postmortem: TanStack npm supply-chain compromise by KajMagnus on Tuesday May 12, 2026 @09:51PM (#48116914)
How do you know the hash in advance?
Re:Postmortem: TanStack npm supply-chain compromise by pas on Friday May 15, 2026 @04:36AM (#48146048)
Perhaps pnpm trusts the local store?
Re:Postmortem: TanStack npm supply-chain compromise by mort96 on Tuesday May 12, 2026 @08:32AM (#48107325)
It's extremely rare that I install a dependency without executing code from it shortly after. I think postinstall scripts are unfortunate and an anti-pattern, but I don't realistically think that their removal would do very much to avoid these kinds of attacks.
Re:Postmortem: TanStack npm supply-chain compromise by staticassertion on Tuesday May 12, 2026 @01:22PM (#48111319)
You should sandbox where you run the code. The thing is, it's very hard for me to know how to sandbox an install script, but it's actually quite easy (and my responsibility as the app dev) to know how to sandbox my tests/ application.