kingfisher/data/rules/planetscale.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

55 lines
1.3 KiB
YAML

rules:
- name: PlanetScale API Token
id: kingfisher.planetscale.1
pattern: |
(?xi)
\b
(
pscale_tkn_[a-z0-9-_]{43}
)
\b
pattern_requirements:
min_digits: 2
min_entropy: 4
examples:
- pscale_tkn_abcdefghijklmnopqrstuvwxyZ1234567890_ABCDEF
validation:
type: Http
content:
request:
headers:
Accept: application/json
Authorization: '{{ USERNAME | append: ":" | append: TOKEN }}'
method: GET
response_matcher:
- report_response: true
- status:
- 200
type: StatusMatch
- type: WordMatch
words:
- '"id":'
- '"username":'
url: https://api.planetscale.com/v1/user
depends_on_rule:
- rule_id: kingfisher.planetscale.2
variable: USERNAME
- name: PlanetScale Username
id: kingfisher.planetscale.2
pattern: |
(?xi)
(?:pscale|planetscale)
(?:.|[\n\r]){0,16}?
(?:USER|ID|NAME)
(?:.|[\n\r]){0,16}?
(
[a-z0-9]{12}
)
pattern_requirements:
min_digits: 2
min_entropy: 3.5
visible: false
examples:
- pscale_user = abcdefghijkl
- 'planetscale_id: hgtmrnzlv1t7'