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

41 lines
No EOL
883 B
YAML

rules:
- name: Clojars Username
id: kingfisher.clojars.1
pattern: |
(?xi)
\b
clojars
(?:.|[\n\r]){0,32}?
(?:ID|USER)
(?:.|[\n\r]){0,16}?
\b
(
[a-z0-9_-]{3,}
)
\b
pattern_requirements:
min_digits: 2
confidence: medium
min_entropy: 1.5
visible: false
examples:
- "clojars_user = my-username"
- name: Clojars API Token
id: kingfisher.clojars.2
pattern: |
(?xi)
\b
(
CLOJARS_[a-z0-9]{60}
)
\b
pattern_requirements:
min_digits: 2
confidence: medium
min_entropy: 4.0
examples:
- "CLOJARS_7a0b5c647fdca75616e99a5629ba28955e53faf6391b1b4461ccd972b0e2"
references:
- https://github.com/clojars/clojars-web/wiki/API
- https://github.com/clojars/clojars-web/wiki/Tutorial-for-library-authors