Skip to content

security/leaked-secrets: Mida optimize.js public project key in script src flagged as secret #574

Closed

Description

@deniskern

Observed

squirrel 0.0.105 reports security/leaked-secrets ("1 potential secret(s) detected — Found in html") on a page whose only match is the public project key of the Mida A/B-testing snippet:

<script async src="https://cdn.mida.so/js/optimize.js?key=<redacted, 22 chars>"></script>

Why it is a false positive

Mida's key query parameter is a public client/project identifier. It ships to every visitor by design, the same way as Klaviyo's company_id or a referrer-restricted Google Maps browser key. Every shop running Mida gets a medium finding it cannot act on.

Minimal repro

<!doctype html><html><head>
<script async src="https://cdn.mida.so/js/optimize.js?key=AbCdEfGhIjKlMnOpQrStUv"></script>
</head><body>ok</body></html>

squirrel audit <url> -C quick --rule-include security/leaked-secrets → 1 finding.

Expected

No finding when the match is the key parameter of a src on cdn.mida.so/js/optimize.js, or more generally a value in the src query of a known client-side tag vendor (related: #359, #362).

Acceptance Criteria

  • The repro page (a <script src="https://cdn.mida.so/js/optimize.js?key=...">) produces no security/leaked-secrets finding
  • The suppression is a general, table-driven rule for the query parameter of a src or href on a known client-side tag vendor (Mida key, Klaviyo company_id, and the other vendors already known to ship public identifiers in script URLs), not a one-off string check for Mida
  • A secret-shaped value in the same query parameter on an unknown host is still reported, and a real server-only secret elsewhere on the same page is still reported
  • Table-driven tests cover the Mida repro, at least two other vendors, an unknown host with the same parameter name, and the existing leaked-secrets corpus tests still pass unchanged
  • docs/rules/security/leaked-secrets.mdx lists the public-by-design vendor identifiers that are not reported, and how to extend the list

Activity

  1. self-assigned this
    on Oct 8, 2026
  2. added
    bug
    P2
    size: S
    rules
    security
    on Oct 8, 2026
  3. nc9 commented on Oct 8, 2026

    @nc9
    Contributor

    Thanks for the clear repro. Triaged as a false positive: a public project identifier in a script URL. Acceptance criteria are added above; the fix will be a general list of known client-side vendor identifiers in script URLs, so Klaviyo, Mida and similar do not each need their own report.

  4. nc9 commented on Oct 10, 2026

    @nc9
    Contributor

    Thanks for the clear report and repro. This is fixed in v0.0.107 (#584): security/leaked-secrets now skips public vendor identifiers in script and link URL queries through a table (Mida key on cdn.mida.so and cdn-eu.mida.so, Klaviyo company_id, reCAPTCHA render). The same parameter on any other host, and a real secret elsewhere on the page, are still reported. The table and how to extend it are in the rule docs under "Vendor identifiers in script URLs are not reported".

    If your real key still triggers a finding on v0.0.107 or later, please comment here with the pattern name from the report and we'll take another look.

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

Metadata

Metadata

Assignees

Labels

P2bugrulessecuritysize: S

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions