Skip to content

New option: ignore matches based on regex patterns (--ignore-match-pattern '^ENC\[AES256_GCM,data:') #1394

Description

@beavuck

Is your feature request related to a problem? Please describe.

Secrets encrypted at rest can trigger detection on the ciphertext: a sops value like ENC[AES256_GCM,data:...] is often
reported as a Generic Password. ignored_matches needs each secret listed and goes stale on re-encryption,
ignored_paths excludes whole files, and --banlist-detector drops the detector everywhere.

Describe the solution you'd like

A repeatable --ignore-match-pattern PATTERN option on ggshield secret scan. A finding is ignored when one of its
match values is matched by a pattern:

ggshield secret scan path secrets.yaml --ignore-match-pattern '^ENC\[AES256_GCM,data:'

There is a matching secret.ignored_match_patterns setting in .gitguardian.yaml

secret:
    #...
  ignored_match_patterns:
    - '^ENC\[AES256_GCM,data:'

Ignored findings are reported as ignored and shown with --all-secrets, like other ignore reasons.

Describe alternatives you've considered

  • ignored_matches -> per-secret, breaks on re-encryption.
  • ignored_paths / --exclude -> excludes whole files, potentially hiding real secrets alongside.
  • --banlist-detector -> loses the detector everywhere it would catch a real leak.

Additional context

I have a working implementation and can open a PR soon if this feature request is approved by maintainers.

Here is a before/after on a sops-encrypted file encrypted with AES256_GCM:

Before:

$ ggshield secret scan path secrets.yaml --json
... "incidents": [{"policy": "Secrets detection", "occurrences": [{"match": "ENC[AES256_GCM,data****...", "type": "password", ...}], "type": "Generic Password",...}], "total_incidents": 1, "total_occurrences": 1 ...

After:

$ ggshield secret scan path secrets.yaml --json --ignore-match-pattern "^ENC\[AES256_GCM,data:"
... "incidents": [], "total_incidents": 0, "total_occurrences": 0 ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:newThis issue needs to be reviewedtype:featureFeature request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions