June 26th, 2024

Cloudflare automatically fixes Polyfill.io for free sites

Cloudflare replaces polyfill.io links with their mirror under cdnjs to enhance Internet safety, addressing concerns of malicious code injection. Users urged to switch to Cloudflare's mirror for improved security.

Read original articleLink Icon
Cloudflare automatically fixes Polyfill.io for free sites

Cloudflare has taken steps to automatically replace polyfill.io links with their own mirror under cdnjs to enhance Internet safety. This decision was made due to concerns about the polyfill service being used to inject malicious JavaScript code into users' browsers. Cloudflare's new feature rewrites any polyfill.io links found on websites proxied by Cloudflare to their mirror, reducing the risk of supply chain attacks. While the feature is automatically activated for free plan websites, paid plan users can enable it with a single click. Cloudflare advises all website owners, regardless of Cloudflare usage, to remove polyfill.io from their projects and replace it with Cloudflare's mirror for security. The company also highlights the importance of proactive measures to ensure website security, such as searching for instances of polyfill.io in code repositories and replacing them with secure alternatives. Cloudflare's decision to replace polyfill.io links aims to protect a wide range of websites from potential security threats associated with the service.

Link Icon 19 comments
By @politelemon - 4 months
I totally get the intention behind this and the final outcome is definitely a safer internet. It's also somewhat justified considering the author has mentioned they never controlled its domain, yet the library has been distributed through that domain, correct? This is a reflection of the extremely poor security practices in the web development world.

At the same time, there is a wrongness in Cloudflare being able to overwrite content and changing the 'truth'. I'm like that larry david gif, I just don't know how to process this.

One more thing to note, if you go to the polyfill repo, they've also mentioned they're using Cloudflare to distribute the library.

https://github.com/polyfillpolyfill/polyfill-service/commit/...

By @skilled - 4 months
> We have taken the exceptional step of using our ability to modify HTML on the fly to replace references to the polyfill.io CDN in our customers’ websites with links to our own, safe, mirror created back in February.

I get that they want to do a good thing, but is this something you agree to when you sign up as a Cloudflare customer? If so, that’s kind of crazy.

edit: I am talking about both free and paid users. A toggle does not discount my question whatsoever, especially if this is on by default for free users. I am asking specifically about terms of service.

By @omoikane - 4 months
This post includes a link to an earlier blog post on "reduce your supply chain risk" in 2024-02-29:

https://blog.cloudflare.com/polyfill-io-now-available-on-cdn...

In the earlier thread, there was a link to triblondon's post on 2024-02-25 where he urges users to remove that dependency:

https://x.com/triblondon/status/1761852117579427975

Unfortunately, neither of these early warnings seem to have gotten much attention. I wonder if there is some news site or service that would make suspicious ownership transfers of this sort more noticeable? Or maybe this type of supply chain changes actually happen all the time and we just got used to them?

By @danslo - 4 months
It doesn't matter anymore, Namecheap has taken down polyfill[.]io: https://x.com/malwrhunterteam/status/1806074377383121148
By @0x1ch - 4 months
In other words, Cloudflare is man in the middling their customers and hijacking delivery to customer CDNs? This time it was beneficial...
By @curiousfab - 4 months
Setting a dangerous precedent, especially doing this by default (no opt-in) needed.

But then again, if the people who carelessly include 3rd party dependencies (i.e. playing with fire) are those who use CF... they probably won't object to it :-)

By @ubanholzer - 4 months
CloudFlare is "fixing" all websites using their proxy automatically, meanwhile polyfill.io is using CloudFlare as a CDN. That's funny.
By @xnorswap - 4 months
Today cloudflare are re-writing payloads to remove malware.

Some grim future who knows if cloudflare will be the ones under new owners re-writing payloads to serve adverts (or worse).

edit: I think my comment is being misunderstood, I'm not saying this will happen, there's just a neat symmetry between exploit and mitigation.

By @jgalt212 - 4 months
I understand all the negativity, but to me CF has provided a least bad immediate solution.
By @ChrisArchitect - 4 months
More discussion on the attack: https://news.ycombinator.com/item?id=40791829
By @slowmovintarget - 4 months
Related:

uBlock origin blocks Polyfill.io https://news.ycombinator.com/item?id=40802393

Polyfill supply chain attack: https://news.ycombinator.com/item?id=40791829

By @sakisv - 4 months
While I appreciate their intention and their transparency on what they're doing, I'll echo other comments here in that I, too, feel a bit uneasy that a 3rd party is rewriting my content.

The good news is that a (strict) CSP can help with that - and they do mention it in their blog post that they don't rewrite anything if there's a CSP header.

It's also worth noting that a (strict) CSP also prevents them from injecting their analytics JS from being injected to your site.

By @Sephr - 4 months
I'm curious as to how Fastly can defend their choice to keep Jake Champion in their employ after the damage he caused by transferring polyfill.io to Funnull[1], triggering this entire incident.

The warning signs should have been obvious. There's no profit to be had in this kind of free CDN.

1. https://x.com/JFSIII/status/1761385341951361182

By @X-Istence - 4 months
Looks like it is down at the .io registry level, I am not getting any NS records for polyfill.io
By @stavros - 4 months
At this point, shouldn't all includes use SRI?
By @ilaksh - 4 months
One obvious issue to me is that we have over-centralized the internet on Cloudflare.

That's great they are fixing it on free sites though.

By @bastawhiz - 4 months
> We have not outright blocked the domain through any of the mechanisms we have because we are concerned it could cause widespread web outages given how broadly polyfill.io is used with some estimates indicating usage on nearly 4% of all websites.

Frankly I find this to be a weak argument. "We'll continue serving malware because broken websites are worse than infected ones" is not a good argument. I'm a cloudflare customer and I think this is a very bad look, even if it does mean websites keep "working."