Skip to content

fix(tech-detect): script-url signatures always read the page markup #1430 - #1431

Closed
nc9 wants to merge 2 commits into
mainfrom
fix/tech-script-url-inline-1430
Closed

nc9 wants to merge 2 commits into
mainfrom
fix/tech-script-url-inline-1430

Conversation

@nc9

@nc9 nc9 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1430

A script-url signature matched the page HTML only when the page had no script bodies attached. Once bodies were attached, only the listed URLs were tested, so a URL an inline snippet writes (Microsoft Clarity's standard loader) was found only on pages that had run out of byte budget. Detection depended on the caps, not the site.

Change

  • script-url always tests the listed script URLs and the page's markup: every tag as written plus the text of each <script> element. One linear pass (pageMarkup), last page cached.
  • Kept: script, link, img, iframe, embed, object, source tags as written (quote-aware, a > inside an attribute does not end a tag) and the text of JavaScript <script> elements up to 16 KB. Not kept: text between tags, comments, <a>, <meta>, JSON data blocks (JSON-LD, __NEXT_DATA__) and larger inline bundles. This also tightens the old no-bodies fallback, which read the whole HTML including prose.
  • The Contentful script-URL signature needs a URL or package form (cdn.contentful.com, contentful.js, contentful@), not the bare word.
  • Cost: about +300 ms on a 5 MB tag-heavy page with bodies attached (reviewer: 419 to 722 ms).
  • Same page, same result with or without bodies attached.

Tests

script-url-inline-1430.test.ts: the standard Clarity snippet plus an attached body is detected, with the same list as without bodies and with an empty script list; a script src and a stored script URL still match; prose naming clarity.ms or Contentful is not detected either way; a commented-out script is not; pageMarkup keeps tags and script text, drops prose, handles unterminated tags and stays linear on 200k scripts and 500k <. All tech-detect suites, the CLI tech-detect parity/limits/headers/fit tests and the supabase signature test pass.

Docs: cloud/technologies.mdx (Script URLs). Not measured: the effect on the stored 33k-site corpus (the issue's 24 Clarity and 10 Contentful sites); re-run the offline corpus pass to confirm the Clarity count returns and see which prose-only Contentful matches go.

Skill change: none.

nik

nc9 added 2 commits October 31, 2026 19:10
…not only when no bodies are attached #1430

Signed-off-by: Nik Cubrilovic <[email protected]>
…cript text, quote-aware tag ends; Contentful needs a URL or package form #1430

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9 nc9 mentioned this pull request Oct 31, 2026
@nc9

nc9 commented Oct 31, 2026

Copy link
Copy Markdown
Contributor Author

Landed in v0.0.149 as b0cbc392 96678942 via #1432. Release: https://github.com/squirrelscan/squirrelscan/releases/tag/v0.0.149. Closing this original.

nik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tech detection: script-url detectors stop seeing inline-loader URLs (Clarity snippet) once a page has script bodies attached

1 participant