Skip to content

fix(rules): redact secrets that appear in the URLs named by leaked-secrets findings #2270

Description

@nc9

Follow-up to #2259 (leaked-secrets scans comments, framework config and source maps).

Problem

Findings and their labels name the URLs of the scripts and resources where a secret was found. When the secret sits in the URL itself, for example a query parameter or a path segment such as /config.json?key=sk_live_... or /api/<token>/data.js, the label repeats the URL, and with it the secret, in the report. The secret is then published in plain text in the place that warns about it.

Acceptance Criteria

  • Every URL shown in a finding label, a message or an item for the leaked-secrets rules has secret-looking query values and path segments redacted. The same detector patterns the rule uses decide what counts, so a matched value becomes a masked form such as sk_live_…abcd, keeping only a short prefix and suffix.
  • A test covers a script URL whose query string contains a detected key, and one whose path contains a detected token. The report text contains neither secret.
  • URLs without a secret are shown unchanged.
  • The redaction applies in every report format (llm, markdown, json, html).
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

    bugsize: S

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions