Nothing, I'm afraid.
This particular attack is very tough to prevent, because:
-
there was no hacking/stealing, the package was given voluntarily. The usual protections like 2FA, code signing, etc. are to keep strangers away, but this was a breach of trust, not a breach of systems.
-
the malicious code was smart enough to activate only in a specific scenario, so it was harder to detect.
Previous discussions on the topic: