Repository navigation
Description
squirrelscan version
0.0.102
Platform
Linux (glibc), Fedora 44
Command run
squirrel audit https://copperinteractive.com -C full --refresh --format llmReproduction
Any page on https://copperinteractive.com (static HTML served by Cloudflare Workers Assets). With the same User-Agent squirrel records in pages.request_headers:
curl -s -D - -o /dev/null \
-H "Accept-Encoding: gzip, deflate, br, zstd" \
-A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36" \
https://copperinteractive.com/about/returns:
cache-control: public, max-age=0, must-revalidate
etag: W/"ad66933fd8e64dd4529f856985df80eb"
content-encoding: zstd
Cloudflare turns the strong ETag into a weak one when it compresses the response. A request without compression gets the strong ETag.
Expected behavior
perf/bad-caching should count the page as declaring a caching policy, because it has a validator plus max-age=0 (the "revalidates" path in the rule docs), and as exposing a validator. A weak ETag is a valid validator for If-None-Match revalidation.
Actual behavior
The stored response headers for every page have "etag": null (and the pages.etag column is NULL), while cacheControl and contentEncoding: "zstd" are recorded correctly. The rule then fails both checks on 14/14 pages:
perf/bad-caching fail 14/14 pages set no caching policy (no freshness lifetime and no validator); 14/14 pages lack an ETag or Last-Modified validator
I haven't confirmed whether the weak W/ prefix is the trigger or the header gets lost when the zstd body is decompressed. Either way, the header is on the wire and missing from the stored record.
Logs or report output
From ~/.squirrel/projects/copperinteractive-com/project.db, pages.headers for /about/:
{"contentType":"text/html","contentEncoding":"zstd","cacheControl":"public, max-age=0, must-revalidate","expires":null,"etag":null,"lastModified":null,"cfCacheStatus":"HIT", ...}Triage notes (maintainer)
The ETag is present on the wire for Accept: */* and absent for the browser Accept: text/html squirrel sends (Cloudflare feature-dependent rewriting), so this is mostly CDN behaviour, not a parser bug. The rule should still say so instead of failing hard.
Acceptance Criteria
- A weak ETag (
W/"...") is recorded and counts as a validator for identity, gzip, br and zstd responses (regression test) -
bad-caching-validatorsnever fails: it caps at warning,bad-caching-freshnessis unchanged - When at least half of the pages missing a validator came through Cloudflare (
server: cloudflare,cf-cache-statusorcf-ray), the finding adds a "may" note naming the documented causes and fixes - The shared CDN detection lives in one helper in
@squirrelscan/utils, reused by the waf detection -
docs/rules/perf/bad-caching.mdxand the CHANGELOG describe the cap and the note - A later issue tracks detecting JavaScript Detections (needs a stored field)
Activity
nc9 commentedon Oct 9, 2026
thanks will look into it
nc9 commentedon Oct 9, 2026
it appears cloudflare may be removing the E-Tag here in this case - I think we can write something to detect this and recommend some cloudflare settings. leave it with me
nc9 commentedon Oct 9, 2026
Thanks for the report. I looked into this and squirrelscan is not dropping the ETag: Cloudflare is not sending it when the request says it wants HTML, which is what squirrel (and every real browser navigation) sends. The
W/prefix and zstd are not the cause.The only difference between these two requests is the
Acceptheader:curl's default
Accept: */*keeps the ETag,Accept: text/htmlloses it, so a plaincurl -Ihides the problem. The same happens withAccept-Encoding: identity. Fortext/htmlrequests Cloudflare rewrites the HTML (here it injects the Web Analytics beacon,static.cloudflareinsights.com/beacon.min.js), and a rewritten body loses its ETag. The page sends noLast-Modifiedeither, so browsers have nothing to revalidate with, and the finding is accurate for real visitors.To fix it on your side, turn off automatic Web Analytics setup for the zone and add the beacon snippet to your pages manually (or turn off the other HTML-rewriting features: Email Address Obfuscation, Rocket Loader, Zaraz), or serve a
Last-Modifiedheader. Then re-run the curl above withAccept: text/htmland you should see theetagline.On our side I'll add a note to the
bad-cachingrule docs and a test that weak ETags survive every encoding.nc9 commentedon Oct 9, 2026
Correction to my earlier comment: I said the missing ETag came from Cloudflare's Web Analytics beacon. That is only supported by a forum post, so please don't rely on it.
What is documented: Cloudflare removes or weakens an ETag on HTML when a feature has to rewrite the body. The ones to check on the zone are Email Address Obfuscation, Automatic HTTPS Rewrites, "Replace insecure JS libraries", and JavaScript Detections (Bot Fight Mode turns that one on). squirrel sends a browser
Accept: text/html, so it records what Chrome receives. A plaincurl(Accept: */*) can still show an ETag.@doradorock, is Bot Fight Mode on for this zone? Turning off the rewrite features above, or sending
Cache-Control: no-transformor aLast-Modifiedheader from the origin, should bring a validator back.On our side we will:
nc9 commentedon Oct 9, 2026
Fixed on main in #606 (will ship in the next release): the validators check no longer fails, and when most of the pages missing a validator came through Cloudflare the finding now says that Cloudflare may drop the ETag from HTML it rewrites, with the documented causes and fixes. A weak ETag is covered by a test across identity, gzip, br and zstd. Still interested in whether Bot Fight Mode was on for your zone.
doradorock commentedon Oct 9, 2026
nc9 commentedon Oct 9, 2026
All good - there was still an issue here where it needed to be communicated better back to users - so appreciate the report