Skip to content

Tech detection: matches inside non-executed content (JSON or import-map script bodies, <template>, commented-out code) count as detections #1550

Closed

Description

@nc9

Found in the #1542 review (import maps). This is pre-existing: v0.0.159 and #1542 behave the same.

What happens

Detectors that read the page HTML also match text inside content the browser never runs or renders. So a vendor URL or tag that only appears there counts as a detection:

  • the raw text of a non-executed <script>: type="application/json", application/ld+json, importmap and other non-JS types. Repro: a page whose only Stripe reference is the string "<script src=\"https://js.stripe.com/v3/\"></script>" inside an import map or JSON script detects Stripe. Real cases on the corpus include embed URLs listed in page-data JSON, and loader URLs in config blobs.
  • <template> content, which is inert until script clones it. A real <script src=…> inside a <template> is detected today.
  • HTML comments that hold commented-out tags or loaders (<!-- <script src="…gtag/js…"></script> -->).

Deliberate marker comments that some fingerprints rely on, such as WordPress plugin banners (Yoast, WP Rocket, WP Super Cache, W3 Total Cache), are real evidence and must keep working. So must CSS evidence inside <style> (Tailwind, Google Fonts, Font Awesome).

Corpus count

Measured on the Product Hunt corpus, 10-shard sample, 5,877 sites, v0.0.159. A (site, technology) pair counts when its only evidence sits in the region:

Region Pairs where it is the only evidence Main technologies
Non-executed <script> bodies (JSON, JSON-LD, import map) 83 youtube-embed 35, shopify-payments 7, clarity 6, unpkg 5, cookiebot 4, tailwindcss 4, react 3, google-tag-manager 3
<template> 8 youtube-embed 4, clarity, wistia, hubspot-forms, google-analytics-4
HTML comments 76 about 14 are deliberate plugin banners (keep); about 10 are Font Awesome banners (likely real inline-SVG use); the rest look like commented-out vendor code
<textarea> 0
<style> (for reference, correct evidence) 114 tailwindcss, google-fonts, font-awesome

Some of the non-executed-script cases may be real usage that a client renders from data (for example a video list in page JSON that becomes YouTube embeds). Those are worth sampling before deciding they are false.

Acceptance Criteria

  • html-type detectors do not match inside the raw text of a non-executed <script> (JSON, JSON-LD, import map or any non-JavaScript type); the Stripe-string repro above detects nothing
  • A <script src=…>, an iframe or any vendor markup inside <template> content is not detected
  • Commented-out tags and loaders inside HTML comments are not detected, while fingerprints that intentionally match a marker comment (WordPress plugin banners) still detect
  • Real <script src> tags and inline loaders outside those regions still detect, and CSS evidence inside <style> still detects
  • The regions are found by one bounded structural pass per page (no per-detector rescans); the existing hostile-input perf tests stay inside their budgets
  • A corpus re-detect shows only the losses classified above (non-executed scripts, templates, commented-out code), with a sample of the removed youtube-embed cases checked by hand

nik

Activity

  1. added
    bug
    size: M
    rules
    on Nov 2, 2026
  2. added theissue type on Nov 2, 2026
  3. 3 remaining items

  4. nc9 commented on Nov 4, 2026

    @nc9
    ContributorAuthor

    Acceptance check against main d7e9b44 (v0.0.167). The region pass shipped in v0.0.165 (06f9c27, hardened by 347147b and 0080fc5); the shopify-payments regression found by the corpus run was fixed in v0.0.167 (6d6fde3).

    # Criterion Result Evidence
    1 No match inside the raw text of a non-executed script PASS packages/tech-detect/tests/non-executed-1550.test.ts "data script bodies" (application/json, ld+json, importmap, speculationrules, x-template, text/html: a Stripe tag and a YouTube iframe written as a JSON string are not detected; same markup live is detected) and "script types" (custom types are data)
    2 Nothing inside <template> content PASS same file, "template content" (script, iframe and html matches inside a template, nesting, self-closing, shadow roots)
    3 Commented-out tags not detected; marker comments still detect PASS same file, "comments" ("a commented-out tag or loader is not detected", "a comment marker a fingerprint matches on purpose still detects", "only the marker detectors read comments")
    4 Real <script src> and inline loaders outside those regions still detect; <style> CSS still detects NOT TICKED The tests pin real tags, known wrapper types and CSS ("what stays evidence"). But the corpus run below found real loaders hidden in delayed-loader wrapper script types (WP Rocket, Perfmatters, consent blockers and similar) that now read as data. See the gap.
    5 One bounded structural pass; hostile-input budgets hold PASS detect.ts builds the region ranges in one pass per page and caches the stripped views; "bounds" and "hostile inputs stay linear" (100,000-element shapes, each under 4 s) pass
    6 Corpus re-detect shows only the classified losses, youtube-embed sample checked by hand NOT TICKED See the gap.

    Ran on main: non-executed-1550.test.ts, importmap-1539.test.ts, link-rel-1539.test.ts and shopify-payments-data-script-1550.test.ts (101 pass), flight-script-narrow-1437.test.ts (60 pass).

    Corpus re-detect (offline, stored pages of 37,248 sites, v0.0.164 against v0.0.165, same harness):

    • 876 (site, technology) pairs lost; every one sits in a classified region: non-JS script bodies 482, HTML comments 374, template content 15, combinations 5. Zero unexplained.
    • 44 pairs gained, all font-awesome (the deliberate banner-comment detector).
    • youtube-embed hand check of 20 of 184 lost pairs: 18 are VideoObject JSON-LD metadata with no player (correct), 1 is a commented-out iframe (correct), 1 is JavaScript in a custom-typed script that builds an embed (possible true positive).

    Gaps:

    • Criterion 6 holds only with an exception. A second class of true-positive loss: 105 pairs on 76 sites (0.2%) where a real tag loader sits in a delayed-loader or consent wrapper type that v0.0.165 now treats as data (rocketlazyloadscript and similar WP Rocket types, o/js-lzl, pmdelayedscript, bv_inline_delayed_js, nitropack/inlinescript, javascript/blocked, a <hash>-module Rocket Loader form, text/babel, a JSON blob listing a Next.js scriptLoader strategy). Clarity and Facebook Pixel are hit hardest (16 of 18 Clarity losses). This also bears on criterion 4.
    • A third loss, shopify-payments (76 sites to 1), was fixed in v0.0.167: all 75 lost sites recovered on the corpus with no other change in the slice.
    • Not shipped yet: a fix for the wrapper types. Proposed direction: treat a script as data only for a known data list and read unknown types as running.
    • Not verifiable from here: the wrapper pairs were classified by wrapper type and 15-site samples, not each read by hand.

    Ticked 1, 2, 3 and 5; left open for 4 and 6 until the wrapper fix ships and the corpus is re-run.

    nik

  5. nc9 commented on Nov 5, 2026

    @nc9
    ContributorAuthor

    Acceptance check against main 7e8416b (v0.0.169). The region pass shipped in v0.0.165. The wrapper-type fixes shipped in v0.0.168 (aabff54, fd1cf9e, 24aa05a, 856dc70) and the bundler list fix in v0.0.169 (31f7e95). The corpus pass below ran on the v0.0.169 release tree (its tree hash is identical to main's).

    # Criterion Result Evidence
    1 No match inside a non-executed script PASS (ticked earlier) packages/tech-detect/tests/non-executed-1550.test.ts "data script bodies"
    2 Nothing inside <template> PASS (ticked earlier) same file, "template content"
    3 Commented-out tags cut, marker comments still detect PASS (ticked earlier) same file, "comments"
    4 Real <script src> and inline loaders still detect, <style> CSS still detects PASS non-executed-1550.test.ts "what stays evidence" and "the wrappers a cache, CDN or consent tool runs later stay read"; deferred-loader-types-1550.test.ts "a loader inside a wrapper type is detected" (every name in DEFERRED_LOADER_TYPES, packages/tech-detect/src/detect.ts: 23 exact names plus the Rocket Loader hash pattern) and "the bundler's ext_resources list: its script URLs are read". Corpus, 105 pairs that v0.0.165 had lost to wrapper types: 77 of 77 deferred-loader pairs recovered, 20 of 20 bundler-list pairs recovered (through the list's id field), 3 of 3 consent-wrapper pairs recovered, none lost again.
    5 One bounded pass, hostile-input budgets hold PASS (ticked earlier) non-executed-1550.test.ts "bounds" and "hostile inputs stay linear"
    6 Corpus re-detect shows only the classified losses, youtube-embed sample checked by hand PASS Offline re-detect over stored pages of 37,248 sites, v0.0.164 against v0.0.165: 876 lost pairs, all in a classified region (non-JavaScript script bodies 482, HTML comments 374, template content 15, combinations 5; zero unexplained); 44 gained, all the deliberate font-awesome banner detector. 20 of 184 lost youtube-embed pairs read by hand: 18 JSON-LD metadata with no player, 1 commented-out iframe, 1 JavaScript in a custom-typed script. Then the v0.0.167 and v0.0.169 trees re-run on 2,795 sites (every site with a v0.0.165 loss, every shopify-payments site, a seeded 2,000-site slice of the rest): 0 pairs lost against v0.0.167, so the 704 pairs still lost against v0.0.164 (876 minus 75 shopify-payments, 77 deferred-loader, 20 bundler, 1 other, plus 1 from the #1539 link-rel change) are the intended removals plus the residuals below.

    Regressions the corpus run found, all fixed and re-measured: shopify-payments 76 to 1 sites (back to 76 of 76 in v0.0.167), delay and consent wrapper types (above), and the bundler list (above).

    Residuals, judged acceptable and left as data by design: 4 pairs on 4 sites where inline JavaScript sits in a custom text/x-* type that no known delay or consent tool writes, and 4 pairs (google-analytics-4) where a framework scriptLoader JSON config lists a gtag URL. Both fall under the first criterion ("any non-JavaScript type", a JSON config), together under 0.03% of corpus sites. The docs state the rule ("an unknown wrapper type is cut until corpus evidence adds it", docs/cloud/technologies.mdx) and the changelog says a scriptLoader JSON is still data. A new wrapper type is a one-line addition to the list when evidence shows up.

    Ran on main: deferred-loader-types-1550.test.ts, non-executed-1550.test.ts, link-rel-1539.test.ts, importmap-1539.test.ts, supabase-preconnect-1539.test.ts (193 pass), shopify-payments-data-script-1550.test.ts, in-code-candidates-1422.test.ts, extras-budget-1420.test.ts, clarity-inbundle-1488.test.ts, clarity-inline-string-1509.test.ts (144 pass).

    Not verifiable from here: the wrapper pairs were classified by wrapper type and sampled, not each read by hand.

    Ticked 4 and 6; all six criteria are met, closing.

    nik

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugrulessize: M

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions