Skip to content

tech-detect: Clarity loader in a double-escaped flight chunk is missed (#1477 residual) #1487

Closed

Description

@nc9

Summary

Residual of #1477. A corpus re-detect of the #1480 fix (flight text rows) recovers the Microsoft Clarity loaders that v0.0.150 found in a Next.js flight payload, except one real install: its standard loader (t.src="https://www.clarity.ms/tag/"+i) sits in a self.__next_f.push chunk of 16 KB or less with the URL double-escaped, a string inside a JSON string (\\\" around the URL), most likely an __html or children value held inside the props of a component the reader does not take for a script.

Acceptance Criteria

  • A synthetic flight fixture with the bare {type, children} loader beside two uses of a ref carrying src+strategy and id+strategy+children is detected, and a ref never seen with a strategy is not (amended 2026-11-01: the real shape is now known, replaces the double-escaped-string fixture)
  • The cause is written on this issue or in the PR body (satisfied by the PR body evidence)
  • The tech-detect: a Next.js flight script re-opens the prose, link and metadata false-positive classes for script-url signatures #1437 negatives (JSON-LD sameAs, a CSP <meta>, a link, prose, a component with prose children) still do not detect
  • Hostile flight payloads (deep nesting, 100,000 references, text rows past their declared length) stay inside their budgets.
  • A re-detect of the one real affected site on the release head finds Clarity (run by the corpus lane, added 2026-11-01)

Activity

  1. added
    bug
    size: S
    rules
    on Nov 1, 2026
  2. added theissue type on Nov 1, 2026
  3. nc9 commented on Nov 1, 2026

    @nc9
    ContributorAuthor

    Investigation with synthetic fixtures (the standard loader inside a flight row, 12 prop shapes; no site data). A string-in-string escape is NOT the problem: a children that is itself JSON text of the snippet is found, the same as a plain one. What is missed is a loader carried by a component that the reader does not take for a script, because it has neither a strategy nor an id beside the code:

    • found: next/script with id and children; a script element with __html; a component with a strategy and __html; children that are JSON text.
    • missed: a $L component with only dangerouslySetInnerHTML or only children (no id, no strategy); a component passing the code in another prop (code, script); __html on a div or children of a noscript; array children holding { __html }; dangerouslySetInnerHTML given as a JSON string.

    So the likely cause on the one real site is a custom or third-party wrapper component. A fix exists in principle (read any string prop of a $L component that is code assigning a script URL, .src = "https://..."), but it also reads code samples a client component displays (a docs page showing the snippet in a code-block component), which is the false-positive class #1437 removed, and I cannot tell which wrapper the real site uses without it. Not built; this needs the site's actual props shape (its flight row, masked) to choose between that and nothing.

    nik

  4. nc9 commented on Nov 1, 2026

    @nc9
    ContributorAuthor

    Corpus check, criterion 5: the single gained Clarity site on the v0.0.155 combined sample (Clarity 187 to 188) is the site this issue was filed about. It is also the only Clarity gain on the 33-shard A/B (769 to 770). The tag v0.0.155 differs from the sampled tree in one test line and no source file. With criteria 1 to 4 ticked earlier, every criterion now holds. Closing as completed.

    nik

  5. nc9 commented on Nov 1, 2026

    @nc9
    ContributorAuthor

    Corpus check of the fix (#1490, shipped in v0.0.155): an A/B on 33 shards, 19,141 sites, #1490 against v0.0.154. 19,140 results identical. The only difference is one Clarity gain on the shape this issue describes (769 to 770 sites with Clarity). No losses; the PostHog, Vue and Square counts are unchanged. A combined 10-shard sample of v0.0.155 (5,877 sites) was 99.7% identical, with the same single Clarity gain.

    nik

  6. nc9 commented on Nov 1, 2026

    @nc9
    ContributorAuthor

    Checked against v0.0.155. Ticked: criteria 1 (the synthetic fixture with the bare loader beside two uses of a ref is detected; a ref never seen with a strategy and a lookalike strategy are not), 2 (the cause is in the PR body), 3 (the #1437 negatives still pass) and 4 (hostile payloads stay inside their budgets, including the new pass-1 node budget and depth guard). Open: criterion 5, a re-detect of the one real affected site on the release head. The corpus comment above reports one Clarity gain on the shape this issue describes, from an A/B of #1490 against v0.0.154; it does not say that the gained site is the original one or that v0.0.155 detects it. Leaving this open until that is recorded.

    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: S

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions