cross-posted from: https://feddit.online/c/tech@feddit.online/p/2118733/world-s-largest-brands-infected-with-malware-via-optimizely
cross-posted from: https://feddit.online/c/tech@feddit.online/p/2118733/world-s-largest-brands-infected-with-malware-via-optimizely
A decent content security policy (CSP) would have stopped this in it’s tracks. The fact that none of these brands cares enough about security or their customers to even have the most basic protections in place is abhorrent
Here’s a funny trick: if you open Google Chrome and use Lighthouse on Google’s own websites (YouTube, Gmail, etc), they fail their own best practices tests. I wish I were kidding
This is an area I don’t know much about: how would CSP have helped in this case?
It is a set of rules for the website, outlining what domains are allowed to do various activities on the page after loading. For example: you can configure it to prevent inline <script> tags, only allow xyz domains to load scripts, and only allow network requests to xyz hosts. This configuration would prevent this from doing anything at all - there would just be errors in the console when the malware attempts to create the malicious script tags.
Most websites don’t bother because it’s mildly inconvenient for the developer to have to whitelist things all the time, and many js libraries are poorly written and will fail to work with this configuration. For example many advertising and tracking libraries (including the one from the article) specifically tell people to enable “unsafe-inline” and “unsafe-eval”. Like it literally has unsafe in the name lol