You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(rules): name Cloudflare JavaScript Detections in the perf/bad-caching ETag note #605
#600 adds a note to perf/bad-caching when most pages missing an ETag or Last-Modified came through Cloudflare. The note is headers-only: it says Cloudflare may have removed the ETag, because the rule cannot tell which rewriting feature, if any, was on.
Cloudflare JavaScript Detections is documented to "strip ETags from HTML responses where JSD is injected" (docs), and Bot Fight Mode turns it on. It is the one ETag-removing feature that leaves a reliable marker in the page, but the marker is an inline script referencing /cdn-cgi/challenge-platform/ (the CF_CHALLENGE pattern in packages/utils/src/fingerprint.ts already matches it). Inline scripts are not in the collected scriptSrcs the streaming engine hands site rules, so the rule cannot see it today.
What it would take
A new collected per-page signal (for example edgeMarkers: string[]), computed once per page from the DOM by a shared helper in @squirrelscan/utils/cdn, reusing the existing pattern. No regex over unbounded raw HTML.
That changes the rule-cache format, so the first audit of each site after the upgrade runs every rule fresh, once. Say so in the CHANGELOG.
perf/bad-caching then names JavaScript Detections in its note when the Cloudflare pages missing a validator carry the marker.
Worth doing only if reports show the headers-only note is not enough for users to find the cause.
Acceptance Criteria
When at least half of the pages missing a validator are behind Cloudflare and carry the JavaScript Detections inline script, the bad-caching-validators note says JavaScript Detections was found on those pages
Pages behind Cloudflare without the marker keep the current headers-only note
The marker is detected the same way on the streaming engine and the v1 engine (squirrel analyze)
A page that only mentions /cdn-cgi/challenge-platform/ in visible text, not in a script, does not count
Detection stays linear on a large adversarial page (a test with a 1 MB page finishes in under 100 ms)
The CHANGELOG states the rule-cache format change, and docs/rules/perf/bad-caching.mdx describes the new note
Checked on 0.0.108 with local fixtures on a public host name, three pages sent with Server: cloudflare and CF-RAY, no ETag or Last-Modified:
Pages over 10 KB with the JavaScript Detections inline script (/cdn-cgi/challenge-platform/scripts/jsd/main.js) near the end, and pages without it, get the same headers-only note on bad-caching-validators: 3/3 pages lack an ETag or Last-Modified validator. 3 of them came through Cloudflare, which may drop the ETag .... So the current behaviour in the issue is accurate.
Small pages (under 10 KB) carrying the same inline script get no note at all. They are classified as WAF challenge pages, Detected 3 challenge/interstitial page(s) via Cloudflare; these pages were excluded from page-level rule scoring., because challenge-platform in the first 10 KB plus a Cloudflare server header counts as a challenge interstitial (packages/waf-detect/src/challenge.ts and CHALLENGE_INTERSTITIAL_PATTERNS in packages/waf-detect/src/providers.ts). Any marker detection for this issue has to agree with that classifier.
origin/main is unchanged in packages/rules/src/performance/bad-caching.ts and in the waf-detect files above.
Activity
nc9 commentedon Oct 11, 2026
Checked on 0.0.108 with local fixtures on a public host name, three pages sent with
Server: cloudflareandCF-RAY, no ETag or Last-Modified:/cdn-cgi/challenge-platform/scripts/jsd/main.js) near the end, and pages without it, get the same headers-only note onbad-caching-validators:3/3 pages lack an ETag or Last-Modified validator. 3 of them came through Cloudflare, which may drop the ETag .... So the current behaviour in the issue is accurate.Detected 3 challenge/interstitial page(s) via Cloudflare; these pages were excluded from page-level rule scoring., becausechallenge-platformin the first 10 KB plus a Cloudflare server header counts as a challenge interstitial (packages/waf-detect/src/challenge.tsandCHALLENGE_INTERSTITIAL_PATTERNSinpackages/waf-detect/src/providers.ts). Any marker detection for this issue has to agree with that classifier.origin/main is unchanged in
packages/rules/src/performance/bad-caching.tsand in the waf-detect files above.feat(rules,utils): perf/bad-caching names Cloudflare JavaScript Detec…
fix(rules,utils): jsd marker is read from the last 60 scripts; wordin…
feat(rules,utils): perf/bad-caching names Cloudflare JavaScript Detec…
fix(rules,utils): jsd marker is read from the last 60 scripts; wordin…
nc9 commentedon Oct 30, 2026
Shipped in v0.0.145 (
533fd7f2c3506213), verified against main: every acceptance criterion is met. Release: https://github.com/squirrelscan/squirrelscan/releases/tag/v0.0.145nik