by goalieca · 1w ago · 0 comments
Oh how I hate that one. I wish Facebook, Instagram, Google and others would figure out serving the public scripts from .com only.
NPM isn't perfect but there's typically a substantial delay between the release of a malicious package and that code getting onto your production environment. Unless you're automatically updating every day, there's a good chance someone will discover the problem before it affects you. And you can always scan your upstream dependencies.
This doesn't work if you're using someone else's CDN. Any change to their content is distributed to all your users immediately.
A javascript file served from example-a.com should be able to run on example-b.org only if it has been signed with the same TLS key used for example-a.com .
https://developers.google.com/tag-platform/security/guides/c...
In the end this is a tradeoff between security and convenience.