Skip to main content

Matchers

RegexMatcher​

Matches a regular expression pattern against the document content.

type (required)​

Type: string

Must be set to RegexMatcher.

pattern (required)​

Type: string

Pattern with named capturing groups. Each named capturing group returns a match.

look_behind​

Type: string

Default: (?<![_a-zA-Z0-9])

Extra expression inserted BEFORE the pattern to ensure we don't capture false positives in the middle of a random string.

look_ahead​

Type: string

Default: (?![A-Za-z0-9!#(*.?[^~_+])

Extra expression inserted AFTER the pattern to ensure we don't capture false positives in the middle of a random string.

AssignmentRegexMatcher​

Regex pattern that matches an assignment of a variable in one or more programming languages.

type (required)​

Type: string

Must be set to AssignmentRegexMatcher.

value_regexp (required)​

Type: string

Value pattern used to match the variable value in an assignment statement.

name_keyword (required)​

Type: string

Keyword pattern that is contained in the variable name of the assignment.

name_prefix​

Type: ['string', 'null']

Prefix pattern that occurs in the variable name before the variable keyword.

AggregateMatcher​

Group multiple matchers. When a secret is composed of multiple matches (for example a client_id and a client_secret), you can group them using the AggregateMatcher. Several matchers can be listed inside of it. All combinations of them will be looked for.

Example:

type: AggregateMatcher
matchers:
- type: RegexMatcher
pattern: '(?P<client_id>acme_[a-z0-9]{12})'
- type: AssignmentRegexMatcher
value_regexp: '(?P<client_secret>[a-z0-9]{24})'
name_keyword: 'client[_-]?id'

type (required)​

Type: string

Must be set to AggregateMatcher.

matchers (required)​

Type: list[Matcher]

The matchers to group.

strategy​

Type: DistanceStrategy

The strategy to use to group matches.

Example:

type: AggregateMatcher
strategy:
type: DistanceStrategy
nb_matches: 2