logoalt Hacker News

duxup • yesterday at 9:43 PM • 3 replies • view on HN

Let’s say I use Optimizely (I don’t), is there a good best practice to say?:

“yeah load this JS m, but it can’t load / random other JS referencing sketchy places”


Replies

Jach • yesterday at 11:03 PM

Besides specifying scripts by hashes, you can also whitelist various domains: https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CSP (and https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/...)

Feels nice knowing several years ago I worked on forcing CSP (including removing unsafe-eval) on some customers for a site builder product, as they have to manually whitelist domains which limits the impact of these sorts of attacks...

This writeup https://blog.report-uri.com/worlds-largest-brands-infected-w... has a section on how CSP helped (or didn't) in this attack.

r1ch • yesterday at 10:03 PM

In theory yes, in practice no since every SaaS wants to ship 5 times a day and add 15 new dependencies on other SaaS providers each release, and marketing wants to load gobs of 3rd party tracking and analytics code from their favorite SaaS of the day without having to get approval from those pesky security people. Let's not even mention ad networks.