Tell HN: Cloudflare silently injects its analytics when you switch nameservers
219
sstagas about 5 hours ago 55 comments
A few hours ago I switched my nameservers to Cloudflare in order to enable R2 bucket serving through my own subdomain, and I found out that it silently had injected a JS analytics snippet in my HTML-only JS-free site textlog.cc — I had to go to the Analytics dashboard, Add the site to the analytics and then disable the snippet. I find this approach entirely invasive, you should opt-in to features like that not have to opt-out. Just a warning out there to folks who might not be aware of this.

Discussion (55 Comments)Read Original on HackerNews
This makes the client only load self-hosted scripts, or scripts only from the specified origins, among the other directives CSP allows (e.g. restricting styles, images, frames, etc.): https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CSP
The RUM Diaries: Enabling Web Analytics by Default
(2 points, 11 months ago): https://news.ycombinator.com/item?id=45291323
(1 point, 11 months ago): https://news.ycombinator.com/item?id=45339321
<script type="module" src="https://static.cloudflareinsights.com/beacon.min.js/v4513226..." integrity="sha512-ZE9pZaUXND66v380QUtch/5sE9tPFh2zg45pR2PB0CVkCtOREv2AJKkSidISWkysEuQ0EH8faUU5du78bx87UQ==" data-cf-beacon='{"version":"2024.11.0","token":"c0859b51a7804ab5a9cc8e9e2b2c4cde","r":1}' crossorigin="anonymous"></script>
You must be allowing Cloudfare to terminate your HTTPS connections; i.e. using them for actual proxying.
I have all my domains set to DNS only, so no CF proxy. Wondering if that is why?
I use them for my registrar, because they offer domains at cost and you can’t beat that. But yes, they make it an extra step to use them without using the CDN.
Once you figure it out, it is fairly straightforward, though, and you can’t beat the price.
The proxy is like 99% of why people use Cloudflare
Cloudflare injected hostile code into a site they are not even hosting? If it's HTTPS, how do they even do that?
Does it violate the "exceeds authorized access" provision in the Computer Fraud and Abuse Act?
It seems incredibly unlikely cloudflare does this when just DNS hosting, if for no other reason then that this would break so many things.
You can disable this, at which point the record will be set as a normal DNS record.
I can see the advantage of Cloudflare's proxy systems, but I wish they'd be clearer about when they're being used and not pretend that this is some DNS feature or that records have been set to one thing when they've actually been set to something else. If nothing else, it makes debugging DNS issues a lot more confusing, particularly if you're not a DNS expert.
You could say the same about the reverse, ie. people set up their site on cloudflare, thought it was "protected", but really it's dns only and their servers are wide open. It's even worse if they migrated from another provider that was providing ddos protection.
Or is it that when you sign over DNS to a provider, they can take over your cert? They can "ass-cert" their own? :)
Worth checking which of your records are actually proxied. DNS-only ones (grey cloud) pass straight through and can't be touched.
https://limereader.com/
Make a CNAME record the same way you would for a CDN subdomain.
(I am not yet running this in production, YMMV.)
- play your small part in keeping the Internet open
- delay or avoid entirely the enshittification that is 100% foreseeable when buying the "free" services of a quasi-monopoly vendor.
If you're not an enterprise customer, alternate providers will also give you every single feature you could ever need and more, and fewer surprises like the OP's.
[1] - https://www.youtube.com/watch?v=a3Xxi0b9trY
And they can fuck off.
If they can inject script, they can also snoop on all your cleartext traffic without you knowing....
If the browser connects directly to your web server, how can there be Cloudfare's analytics stuff?
Check what IP address you are connecting to when you load textlog.cc. Is that an address that you control? If it's not an address that you control, where is it getting your page, and is that not called proxying?