kingfisher/data/rules/bitbucket.yml
Mick Grove 0f953f59a5 pattern_requirements for rules — Post-regex character-class gating to cut false positives without lookarounds. Authors can now require minimum counts of digits, uppercase, lowercase, and special characters, with an optional custom special-char set.
Why: Hyperscan doesn’t support lookaheads/behinds, so many “must contain X and Y” checks had to be baked into the regex (hurting readability) or were impossible. pattern_requirements applies lightweight, in-memory checks after a match is found, keeping patterns fast and clean.
2025-11-04 13:55:31 -05:00

67 lines
No EOL
1.6 KiB
YAML

rules:
- name: Bitbucket Client ID
id: kingfisher.bitbucket.1
pattern: |
(?xi)
\b
bitbucket
(?:.|[\n\r]){0,16}?
(?:client|id)
(?:.|[\n\r]){0,16}?
([a-z0-9]{30,40})
\b
pattern_requirements:
min_digits: 2
min_entropy: 3.5
confidence: medium
examples:
- bitbucket_id=byl2nhrv34zaclukjhvomlvjabkujf
- bitbucket.client.ID=abcdefghij1234567890klmnopqrst
validation:
type: Http
content:
request:
headers:
Authorization: Basic {{ TOKEN | b64enc }}
method: GET
response_matcher:
- report_response: true
- status:
- 200
type: StatusMatch
url: https://api.bitbucket.org/2.0/user
- name: Bitbucket Secret
id: kingfisher.bitbucket.3
pattern: |
(?xi)
\b
bitbucket
(?:.|[\n\r]){0,32}?
(?:SECRET|PRIVATE|ACCESS|KEY|TOKEN)
(?:.|[\n\r]){0,32}?
\b
(
[a-z0-9+_\-+]{44}
)
\b
pattern_requirements:
min_digits: 2
min_entropy: 3.5
confidence: medium
examples:
- bitbucket_key=HedmnK9h6KD_eh9KK8FlI9ahUc8WfaNZ4gulbrtN2ouV
- bitbucket_secret=kd8j2h4jf9s8mf6l4k9j2h4jf9s8mf6l4k9j2h4jf9s8mf6l
validation:
type: Http
content:
request:
headers:
Authorization: Bearer {{ TOKEN }}
method: GET
response_matcher:
- report_response: true
- status:
- 200
type: StatusMatch
url: https://api.bitbucket.org/2.0/user