Comment by weird-eye-issue
11 days ago
What is the alternative when you need to embed third-party JavaScript on your pages? Other than just "not doing that"?
11 days ago
What is the alternative when you need to embed third-party JavaScript on your pages? Other than just "not doing that"?
If it's available, pull the third party JS in at build time via package manager rather than at runtime via a CDN you don't control.
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.
Vet everything, cut down to 2-3 services tops. Selfhost analytics whenever possible. Point to the OP article when asked why we can’t blindly put 30 tags using GTM.
Response to your pointing out: "so what?"
> Response to your pointing out: "so what?"
Then you've done your job and move on. Just make sure that there's enough public record of your warning that - when the next cdn supply chain attack happens - you can say "I warned you about this and you decided not to take action".
No organization is perfect. I don't think this is something to quit over. Just make sure to CYA.
Response: "Here's my two weeks notice for leaving, let me know if you want to start caring about users again".
Life's too short to work for people who don't care about others.
4 replies →
A certificate-based approach for scripts residing on different domains, for example, so you can be sure it hasn't been tampered with.
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 .
CSP allows you to configure your loaded JS with a complementary hash check. If you're the one who puts the script on your page, in theory, it should be safe for as long as remains the same.
Isn't this already true if the script is served over HTTPS?
Wouldn't this protect you only against mitm attacks?
How would that actually look in reality?
Same approach as a domain cert - scripts served through CORS should sport their own public signature specific to the origin domain to be checked against by the browser before the execution. If the file has been tampered it should be immediately apparent.
Other than tracking, what situations are there where "not doing that" is not an option?
Not doing that. It is just not a secure thing to do.
Proxy through your own domain? Has its own issues though
That is not any more secure if you are just blindly proxying the third party scripts and in fact is worse since it runs in the context of your own domain.
Since the third party tag can request anything, this doesn't stop anything and now your domain has an open redirect.