Skip to content

Can regex detectors run without keywords? #4417

@azrsamuel

Description

@azrsamuel

Hello,

First of all, thank you very VERY much for maintaining such a wonderful and useful tool!! 🙌

I’ve been experimenting with custom detectors via 'config.yaml' and noticed that keywords seem to be mandatory. For example:

detectors:
- name: IBAN detector
  keywords:
  - IBAN
  regex:
    token: (?i)\b[a-z]{2}\d{2}(?:[ -]?\d){21}\b

This works when the string "IBAN" is present in the code.
However, if I remove the keywords section, the scan doesn’t start and fails with:

error parsing the provided configuration file {"error": "no keywords"}

If I try to use a regex inside keywords, either I got an error or it is treated as a literal string and does not act as a regex.

The challenge is that in many real-world scenarios (IBANs, credit cards, etc.), these values often appear without any keyword nearby. Relying on keywords means maintaining huge lists of possible variations, and still missing many cases.

My question is:

  • Is there a way to configure detectors so that the regex runs independently of keywords?

If not, would you consider supporting regex-only detectors, either by making keywords optional or allowing keywords themselves to be also regex patterns?

Thanks a lot for clarifying whether this is already possible, or if it makes sense to be considered as a new feature :)

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions