Skip to content

tech-detect: restore Klaviyo script recall lost by the anchored scriptSrc signature #1457

Closed

Description

@nc9

Follow-up to #1451. Moving the Klaviyo script signature to the anchored scriptSrc helper (needed for the CodeQL finding) narrowed it. The inline loader and theme app block signals cover the common Shopify case, but these script forms are no longer detected:

  • an unquoted src=https://static.klaviyo.com/onsite/js/klaviyo.js
  • a src that comes after more than 300 characters of other attributes
  • a loader built in JavaScript (b.src="//static.klaviyo.com/onsite/js/klaviyo.js")
  • <link rel="preload" href=...> and data-src lazy loaders
  • a proxied URL in the script list

And one new false positive: a commented-out <script src=...klaviyo.js>, because the html detector reads comments.

Acceptance Criteria

  • Each form above is detected as Klaviyo, one fixture per form, with and without script bodies attached
  • A link, a code sample in a <pre> and a commented-out script tag are not detected
  • The CodeQL missing-regexp-anchor check stays green
  • The 23-bundle real-library check shows no new matches

Activity

  1. added
    enhancement
    size: S
    rules
    on Oct 31, 2026
  2. added theissue type on Oct 31, 2026
  3. WilliamK112 commented on Oct 31, 2026

    @WilliamK112
    Contributor

    I would like to take this. I will add one fixture for each accepted loader form (with and without attached script bodies), pin the link/pre/comment false positives, keep the regex anchored for CodeQL, and run the focused technology plus real-library checks.

  4. nc9 commented on Nov 1, 2026

    @nc9
    ContributorAuthor

    Shipped in v0.0.153 (18310961 52d5ef4f 8b554b89 8dbe7cff d99cfb63 31ebd074), verified against main: every acceptance criterion is met. One fixture per loader form, with and without script bodies attached (klaviyo-script-recall-1457, 11 tests); a link, a code sample in a <pre> and a commented-out script tag are not detected; the CodeQL check stayed green on the release; and the 23-bundle real-library comparison between main and the fix shows no new matches (0 diffs, and 0 on 19 real pages). Known limits are named in the changelog. Release: https://github.com/squirrelscan/squirrelscan/releases/tag/v0.0.153

    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

    enhancementrulessize: S

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions