Repository navigation
Conversation
nc9
force-pushed
the
feat/clarity-inbundle-1488
branch
from
November 1, 2026 06:40
6f57d34 to
baf3815
Compare
…t in a first-party bundle #1488 Signed-off-by: Nik Cubrilovic <[email protected]>
nc9
force-pushed
the
feat/clarity-inbundle-1488
branch
from
November 1, 2026 09:36
baf3815 to
777d916
Compare
Merged
Contributor
Author
|
Landed in v0.0.156 as nik |
This was referenced Nov 1, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1488.
Microsoft Clarity had no bundle detector. The standard loader,
t.src="https://www.clarity.ms/tag/"+i, bundled into a first-party script was found before v0.0.150 only by accident (a whole-text read of the page), and a few real installs lost Clarity when #1430 removed that read.inBundledetector on theclarityfingerprint:.src =orsetAttribute("src", ...)followed by a string, template literal or quote ofhttps://[www.]clarity.ms/tag/. The assignment is code and the URL after it is a string, so the match starts in code (theinCoderule) while a docs string, a comment or prose that only names the URL does not match. The hintclarity.ms/tag/is declared, so a capped scan sends the window around it.clarity-inbundle-1488.test.ts, 5; 4 fail without the detector): the standard snippet inside a bundled module, thesetAttributeand template-literal forms with and withoutwwwand withhttp:, deep in a 30,000-line bundle; negatives: the URL in a docs string, a comment, a help string, an object value, another host's.src, a look-alike host (clarity.ms.evil.invalid) and the library URLclarity.js; and 8 MB of near-miss assignments, with and without the real one at the end, under the time budget.bundle-content-1254, fingerprints, pattern-bounds, extras-budget andscript-url-inline-1430pass; tsgo is clean.docs/cloud/technologies.mdx, CHANGELOG under Unreleased / Added. Synthetic text only.Review round 1: a sampler test (a bundle over 400 KB with the loader mid-file: the hint
clarity.ms/tag/is declared,sampleBundleExtrassends the window, the head plus windows detect it and the head alone does not; removing the hint fails it); negatives that put the whole assignment inside a string (var d='t.src="https://www.clarity.ms/tag/"+i';) so the in-code rejection is pinned, not only the\"case; protocol-relative//www.clarity.ms/tag/is accepted (same host and path, anchored by the.src =code) andsetAttribute (with a space; the Firebase comma in the docs. Known limits, pinned as negative tests and listed in the docs: the URL split by concatenation or held in a variable,{ src: ... }or JSX,s["src"] = ..., and loader code inside${}. Rebased onto main.The double-escaped flight chunk (#1487) is a separate shape, not touched here.
Skill: no change needed.
nik