Repository navigation
fix(rules): skip vendor public identifiers in script URL queries in leaked-secrets - #584
Conversation
…eaked-secrets Add a table-driven list of vendor identifiers that ship in the query of a script or link URL (Mida key, Klaviyo company_id, reCAPTCHA render). A match lying wholly inside one of those parameter values on the exact vendor host and path is not reported. The same parameter on other hosts, other values on the page and longer secrets that contain the value are still scanned. Refs #574 Signed-off-by: Nik Cubrilovic <[email protected]>
|
Status: implementation, tests and docs are pushed. Waiting for the bot review; I will address critical, high and medium findings and will not merge. |
|
Review of #584 (vendor public identifiers in leaked-secrets). The change is well scoped and I found nothing blocking. The matching is positional and exact, and the negative tests cover the lookalike-host, userinfo, port and nested-URL cases. I read the diff only and did not run the tests.
Test coverage is good. Docs and baseline updates look consistent. |
|
Thanks for the review. No critical, high or medium findings, so no push for this round.
|
|
Review of #584 (vendor public identifiers in URL queries, leaked-secrets) I read the diff only and did not run the tests. I found no blocking problems. The suppression is positional and exact: host, path and param must all match, and a finding is dropped only if it lies wholly inside the value span. The negative tests cover lookalike hosts, userinfo, port, other path, other param and param-name case.
Performance: one |
|
Review of #584 (vendor public identifiers in script URLs). I read the diff and did not run the tests. Overall the design is sound: it is positional and exact, the scan is bounded, and the tests cover lookalike hosts, userinfo, ports and case. I found no blocking issues.
|
…al tier Merging main brought in #589 (placeholder connection strings drop to medium) and #584 (vendor public ids in script URLs). Escalating every medium server-only hit in a script turned those back into critical fails, so: - DigitalOcean Spaces Key leaves the server-only set: it matches the access key id by shape alone, the public half of the pair, and public vendor ids share that shape (#574). - A value containing EXAMPLE (AWS's documented example credentials), a connection string the confidence pass marked as a placeholder host or database, and a database URL to localhost/127.x/[::1] keep their tier instead of escalating. A Next.js docs page inlines every code sample into a script payload, so these would otherwise read as critical. - Two tests from main read only the high and medium checks; they now see the critical check too, and the precision positive control expects critical for a script hit. Signed-off-by: Nik Cubrilovic <[email protected]>
Refs #574
What changed
security/leaked-secretsnow has a table,PUBLIC_URL_IDENTIFIERS, of vendor identifiers that ship in the query string of a script or link URL.scanContentcomputes the span of each such parameter value once per content and skips any match that lies wholly inside one. The check is positional and exact: the host, the path and the parameter name must all match, so nothing is matched by substring.Initial rows: Mida
key(cdn.mida.so,cdn-eu.mida.so,/js/optimize.js), Klaviyocompany_id(static.klaviyo.com,/onsite/js/klaviyo.js; Klaviyo's docs call it the public API key) and Google reCAPTCHArender(site key;www.google.comandwww.recaptcha.net). Cookiebot, Zendesk and hCaptcha were considered and left out because I could not confirm a first-party statement that the value in the URL is public.Acceptance criteria
security/leaked-secretsfinding. Test:the Mida optimize.js repro reports nothinginpackages/rules/tests/leaked-secrets.test.ts. The fixture uses a value shape the rule does flag (a DigitalOcean Spaces key shape, medium), because the issue's literal sample value does not match any pattern on current main.srcorhref, not a one-off for Mida. Evidence:PUBLIC_URL_IDENTIFIERSinpackages/rules/src/security/leaked-secrets.ts; tests loop over every vendor case with bothsrcandhref, and one test asserts every table row is exercised.still reported: …(unknown host, lookalike host suffix and prefix, userinfo, port, host inside another URL's path, other path, other param, param name case),a vendor URL does not hide a real secret elsewhere on the page,the same value outside the vendor URL is still reported,a longer secret that contains the identifier is not hidden by it,a secret in a non-identifier parameter of a vendor URL is still reported.tests/security/leaked-secrets.test.ts(2276 tests, 0 fail),tests/leaked-secrets.test.ts,literal-prefilter,secrets-confidence,rule-time-budgetandredos-recheck, each on its own.docs/rules/security/leaked-secrets.mdxlists the vendor identifiers that are not reported and how to extend the list. Section: "Vendor identifiers in script URLs are not reported".Checks run
bun run typecheckinpackages/rulesmake validateindocsbun run format:checkdetect-secrets-hookagainst.secrets.baseline(fixture values carry inline pragma allowlist comments; the baseline change is line numbers only)Notes
leaked-secrets-publiceither, following the issue's "no finding".Agent skill
No change needed to the squirrelscan agent skill: no CLI flag, output field or workflow changed.
Generated by Claude Code