Skip to content

fix(tech-detect): restore Klaviyo loader recall (#1463 adopted) #1457 - #1464

Closed
nc9 wants to merge 6 commits into
mainfrom
fix/klaviyo-loader-recall-1457
Closed

nc9 wants to merge 6 commits into
mainfrom
fix/klaviyo-loader-recall-1457

Conversation

@nc9

@nc9 nc9 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Adopts #1463 (William, #1457: restore Klaviyo loader recall) by cherry-pick with authorship preserved (three commits), plus two maintainer commits for the review findings. Refs #1457 (no auto-close); #1463 is closed with the new SHAs after the release.

Commits

Commit Author What
fix(tech-detect): restore Klaviyo loader recall #1457 (aa9e382a) William (Ching-Wei Kang) unquoted and long-attribute src, data-src, preload link, inline element.src = loader, proxied collected URL; tests
fix(tech-detect): bound Klaviyo loader scan #1457 (37cdc95e) William browser-trimmed leading space in a quoted src; hostile-opener bound tests
docs(changelog): keep Klaviyo fix unreleased #1457 (1dc03c38) William changelog under [Unreleased]
fix(tech-detect): klaviyo inline-loader scan stays inside its own script, only a preload link loads it, bounded-time test #1457 maintainer follow-ups below
docs(changelog): name the Klaviyo loader recall limits #1457 maintainer known limits of the recall
fix(tech-detect): klaviyo in-tag scans stop at the next line-start tag; bounded-time tests for tags holding many openers maintainer in-tag hardening (below)

Maintainer follow-ups

  • The inline-loader pattern's lazy body scan ran on past the script's own body into later parts of the page markup: 1 MB of empty <script></script> took about 4 s here (8 MB 36 s) against about 0.1 s (1.3 s) after the fix. The body is bounded by the next kept tag at a line start; a bounded-time test (1 MB under 1.5 s) and a test that an empty script cannot claim the next script's assignment are added. William's per-line bound tests pass against this pattern.
  • The link form requires rel=preload or rel=modulepreload (either side of the href); a stylesheet, prefetch or relless link no longer counts.
  • The in-tag scans (^<script\b[^>]{0,65536} and the link form) are tempered to stop at the next line-start <: one tag whose quoted attribute held thousands of line-start <script openers took 23 s at 0.25 MB and 107 s at 1 MB for the Klaviyo patterns alone, and now 4 ms and 14 ms. Tests: two attribute-embedded openers in pattern-bounds, and a 1 MB bounded-time case for script and link tags (3 s bound).
  • Known limits named in the changelog: a quoted marker in a raw <pre> or JSON block, an element.src = "..." on a non-script element and an assignment inside a block comment still count.

Checks

tsgo clean in tech-detect; cli format:check and lint clean; detect-secrets clean; docs make validate; all 17 tech-detect test files by path, 0 fail; the 23-bundle comparison (main vs this branch, inline and external, with and without script bodies) and the 19 real pages: 0 diffs; CHANGELOG guard clean. No skill, workflow, rule-id or package.json change. No version bump: draft for the next batch.

WilliamK112 and others added 5 commits November 1, 2026 10:23
Signed-off-by: Ching-Wei Kang <[email protected]>
(cherry picked from commit aa9e382)
Signed-off-by: Ching-Wei Kang <[email protected]>
(cherry picked from commit 37cdc95)
Signed-off-by: Ching-Wei Kang <[email protected]>
(cherry picked from commit 1dc03c3)
…ipt, only a preload link loads it, bounded-time test #1457

Signed-off-by: Nik Cubrilovic <[email protected]>
(cherry picked from commit e0b82cf)
Signed-off-by: Nik Cubrilovic <[email protected]>
(cherry picked from commit 1a844e4c9651222b1cabdb03f6dc8b6d31229440)
@nc9 nc9 mentioned this pull request Oct 31, 2026
3 tasks done
@nc9
nc9 force-pushed the fix/klaviyo-loader-recall-1457 branch from e0b82cf to 384a4ab Compare October 31, 2026 23:30
…g; bounded-time tests for tags holding many openers

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 marked this pull request as ready for review October 31, 2026 23:45
@claude

claude Bot commented Oct 31, 2026

Copy link
Copy Markdown

Reviewed the diff (fingerprint, tests, docs, changelog). I found no blocking problems. The bounds are sound: each in-tag scan is capped at 65536 characters and stops at the next line-start tag, and the inline-loader body scan is capped at 16384 characters and stops at the next kept tag. The tests cover the hostile shapes. I did not run the suite myself.

  • (low) packages/tech-detect/tests/pattern-bounds.test.ts: the Klaviyo bounds test finds the loader detector with pattern.source.includes("\\.src\\s*=\\s*"). A harmless rewrite of the regex source would make loader undefined, and the expect(loader && ...) line would then fail with an unhelpful message. A clearer failure message, or a lookup that doesn't depend on source text, would be more robust.
  • (low) klaviyo-script-recall-1457.test.ts: the timing assertions (3 s) depend on the CI machine. The PR reports about 14 ms on the hostile cases, so the margin is large. That is fine, but keep an eye on them if CI gets noisy.
  • (nit) other.ts: TAG_BODY and OWN_BODY hardcode the tag list and the newline-join behaviour of pageMarkup. A short comment pointing at where pageMarkup is built would help the next editor keep the two in sync. The existing comment partly does this already.
  • (nit) The CHANGELOG [Unreleased] entry is long. The known-limits sentence could move to the docs page only.

@nc9

nc9 commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Landed in v0.0.153 as 18310961 52d5ef4f 8b554b89 8dbe7cff d99cfb63 31ebd074 via #1476. Release: https://github.com/squirrelscan/squirrelscan/releases/tag/v0.0.153. Closing this original.

nik

@nc9 nc9 closed this Nov 1, 2026
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.

2 participants