You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
security/leaked-secrets: items hide value length and location; add meta.length and an offset #1230
Observed on squirrel v0.0.138; maskSecret and the item builder in packages/rules/src/security/leaked-secrets.ts are unchanged on current main.
Problem
A security/leaked-secrets item carries id: "<type>: <masked value>", label: "Found in <location> (<url>)" and optional decoded meta. The mask is the first 6 characters, up to 20 stars, then the last 4 (value.slice(0, 6) + "*".repeat(min(len - 10, 20)) + value.slice(-4)). Consequences when verifying a flag by hand:
The star run is capped at 20, so a 40-character and a 400-character value look identical; the length (often the quickest false-positive tell) is hidden.
For inline-script and html locations the label names only the page URL. There is no byte offset or line and column, so finding the match in a minified 1 MB page means searching for a 6-character prefix.
Repro: audit a page with an inline <script> containing a long value assigned to apiKey and compare the JSON item for a 32-character and a 200-character value: the ids have the same shape and nothing else tells them apart.
Proposal
Add to each item's meta (so the JSON, LLM and XML renderers carry it): length (characters of the matched value) and offset (zero-based character offset into the scanned body, or line/column), plus scriptUrl or scriptIndex for inline scripts. Keep the value itself masked.
Acceptance Criteria
Every security/leaked-secrets item in -f json output has meta.length equal to the matched value length.
Every item has an offset (or line and column) that, applied to the fetched body, points at the first character of the match; a test asserts this for an inline script and an external script.
Inline-script items identify which script (index or position) the match is in.
The masked id is unchanged and no unmasked value appears in any output.
I can take this. I will keep the masked id unchanged, thread source-location data through the existing leaked-secret match/item path, and add focused inline/external-script tests that prove meta.length, match offset, and inline script identification without exposing the raw value.
Activity
WilliamK112 commentedon Oct 29, 2026
I can take this. I will keep the masked
idunchanged, thread source-location data through the existing leaked-secret match/item path, and add focused inline/external-script tests that provemeta.length, match offset, and inline script identification without exposing the raw value.test(rules): validate leaked-secret offsets squirrelscan#1230
feat(rules): locate leaked-secret findings #1230
test(rules): validate leaked-secret offsets #1230
nc9 commentedon Oct 30, 2026
Fixed in v0.0.142 (d1b8b958), via the stacked release PR #1331.