I'm surprised there is no mention of subresource integrity in the article. It's a low effort, high quality mitigation for almost any JS packages hosted by a CDN. EDIT: Oh, it's because they are selling something. I don't know anything about their offerings, but SRI is made for this and is extremely effective.
SRI generally won't work here because the served polyfill JS (and therefore the SRI hash) depends on the user agent/headers sent by the user's browser. If the browser says it's ancient, the resulting polyfill will fill in a bunch of missing JS modules and be a lot of JS. If the browser identifies as modern, it should return nothing at all. Edit: In summary, SRI won't work with a dynamic polyfill which is part of the…
Polyfill supply chain attack hits 100K+ sites
21–30 of 387 posts
Re: Polyfill supply chain attack hits 100K+ sites
#22Re: Polyfill supply chain attack hits 100K+ sites
#23I had this conversation countless times with developers: are you really ok if someone hijacks the CDN for the code you're including? They almost always seem to be fine with it, simply because everyone else is doing it like this. At the same time they put up with countless 2FAs in the most mundane places. The follow up of "you know that the random packages you're including could have malware" is even more hopeless.
yes you just put integrity="sha384-whatever" and you're good to go
Re: Polyfill supply chain attack hits 100K+ sites
#24Re: Polyfill supply chain attack hits 100K+ sites
#25Re: Polyfill supply chain attack hits 100K+ sites
#26Earlier quoted context omitted.
SRI generally won't work here because the served polyfill JS (and therefore the SRI hash) depends on the user agent/headers sent by the user's browser. If the browser says it's ancient, the resulting polyfill will fill in a bunch of missing JS modules and be a lot of JS. If the browser identifies as modern, it should return nothing at all. Edit: In summary, SRI won't work with a dynamic polyfill which is part of the…
It absolutely would work if the browser validates the SRI hash. The whole point is to know in advance what you expect to receive from the remote site and verify the actual bytes against the known hash. It wouldn’t work for some ancient browser that doesn’t do SRI checks. But it’s no worse for that user than without it.
Re: Polyfill supply chain attack hits 100K+ sites
#27Earlier quoted context omitted.
SRI generally won't work here because the served polyfill JS (and therefore the SRI hash) depends on the user agent/headers sent by the user's browser. If the browser says it's ancient, the resulting polyfill will fill in a bunch of missing JS modules and be a lot of JS. If the browser identifies as modern, it should return nothing at all. Edit: In summary, SRI won't work with a dynamic polyfill which is part of the…
It absolutely would work if the browser validates the SRI hash. The whole point is to know in advance what you expect to receive from the remote site and verify the actual bytes against the known hash. It wouldn’t work for some ancient browser that doesn’t do SRI checks. But it’s no worse for that user than without it.
Re: Polyfill supply chain attack hits 100K+ sites
#28Earlier quoted context omitted.
SRI generally won't work here because the served polyfill JS (and therefore the SRI hash) depends on the user agent/headers sent by the user's browser. If the browser says it's ancient, the resulting polyfill will fill in a bunch of missing JS modules and be a lot of JS. If the browser identifies as modern, it should return nothing at all. Edit: In summary, SRI won't work with a dynamic polyfill which is part of the…
It absolutely would work if the browser validates the SRI hash. The whole point is to know in advance what you expect to receive from the remote site and verify the actual bytes against the known hash. It wouldn’t work for some ancient browser that doesn’t do SRI checks. But it’s no worse for that user than without it.
Re: Polyfill supply chain attack hits 100K+ sites
#29> this domain was caught injecting malware on mobile devices via any site that embeds cdn.polyfill.io I've said it before, and I'll say it again: https://httptoolkit.com/blog/public-cdn-risks/ You can reduce issues like this using subresource intergrity (SRI) but there are still tradeoffs (around privacy & reliability - see article above) and there is a better solution: self-host your dependencies behind a CDN servic…
I can kind of understand why people went away from this, but this is how we did it for years/decades and it just worked. Yes, doing this does require more work for you, but that's just part of the job.
Re: Polyfill supply chain attack hits 100K+ sites
#30But Microsoft Azure for GitHub ScanningPoint 2024 is SOC2 compliant. How could this happen?