cerbia.core.scanners.SecretScanner detects configured credential patterns and, optionally, high-entropy hexadecimal or Base64-like values that do not already match a known pattern.
| Parameter | Default | Meaning |
|---|---|---|
|
built-in set |
Replacement |
|
|
Pattern triples appended to the selected set. |
|
|
Enable high-entropy fallback detection. |
|
|
Finding severity. |
|
|
Finding action. |
|
|
Accepted content types. |
The scanner returns match spans and the highest detected score. Entropy fallback skips candidates fully covered by existing pattern matches to avoid duplicate findings.
Built-in false-positive filtering
The built-in connection-string rule ignores credential-free mongodb://, postgres://, mysql://, and redis:// URLs containing only valid hosts, optional ports, paths, and ordinary query option pairs. Comma-separated hosts are supported only for MongoDB, Postgres, and simple MySQL URLs; each host (including bracketed IPv6) is checked individually. Redis URLs with multiple hosts remain findings as malformed input. Any userinfo, including a username without a password or encoded userinfo, remains a finding.
Query keys and values are percent-decoded once with strict UTF-8 checking. Credential keys such as user, username, password, passwd, pwd, secret, token, api_key, and access_token remain findings, including case/separator variants, common prefixed forms such as clientSecret or db_password, and numbered suffixes such as password1 or pass%77ord2. Values with built-in secret patterns, assignments, userinfo, or embedded URLs also remain findings. Other ordinary option pairs do not require a driver-specific allowlist. Malformed URLs, invalid escapes, fragments, ambiguous encoded structure, double encoding, and unsafe suffixes are conservatively retained, not reduced to a safe URL prefix.
The built-in generic-secret assignment rule ignores only complete, case-sensitive unresolved references:
-
${oc.env:ENV_NAME}, whereENV_NAMEmatches[A-Za-z_][A-Za-z0-9_]*. -
Dot-separated identifiers such as
${settings.password}, where each segment follows the same identifier grammar and at least two segments are required.
Matching single or double quotes may surround the whole reference. Only optional spaces or tabs may follow before the line/input boundary. Same-line suffixes remain findings even when they resemble separate assignments, because they may belong to a YAML plain scalar. Independent literal findings are preserved. Defaults, arguments, concatenations, literal prefixes/suffixes, nested or escaped expressions, malformed references, and unsupported syntax remain findings. References are never resolved; scanning does not read environment variables, evaluate expressions, or access the network.
These are heuristic exclusions, not credential validation: unfamiliar credential names or opaque secrets may not be recognized, while ambiguous legitimate syntax may still be flagged. A custom patterns or extra_patterns rule with the same name, compiled regular expression, and risk score as a built-in rule inherits its filtering; rules that differ in any of those tuple values are unaffected. Original regex length thresholds, surviving spans, counts, and scores are unchanged. Optional entropy detection remains independent and may still flag content inside an excluded match.
Custom patterns
Each custom pattern is a three-value list: display name, regular expression, and risk score. Invalid regular expressions fail when the scanner is constructed, which makes cerbia validate useful for catching configuration errors early.
scanners:
- scanner: cerbia.core.scanners.SecretScanner
init_args:
entropy_detection: true
extra_patterns:
- ["Application token", "APP-[A-Z0-9]{16}", 0.9]