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

57 lines
1.4 KiB
YAML

rules:
- name: ClickHouse Cloud Secret Key
id: kingfisher.clickhouse.1
pattern: |
(?xi)
\b
(
4b1d[a-z0-9]{38}
)
\b
pattern_requirements:
min_digits: 2
confidence: medium
min_entropy: 3.5
examples:
- "4b1dwEZ8aNo1U9ODBqffSci1INBrltLHM2d1bHF4dq"
validation:
type: Http
content:
request:
method: GET
url: "https://api.clickhouse.cloud/v1/organizations"
headers:
Authorization: "Basic {{ CLICKHOUSE_ID | append: ':' | append: TOKEN | b64enc }}"
response_matcher:
- report_response: true
- type: StatusMatch
status: [200]
- type: WordMatch
words:
- '"id":'
- '"name":'
match_all_words: true
depends_on_rule:
- rule_id: "kingfisher.clickhouse.2"
variable: CLICKHOUSE_ID
references:
- https://clickhouse.com/docs/en/cloud/security/service-accounts
- name: ClickHouse Cloud Key ID
id: kingfisher.clickhouse.2
pattern: |
(?xi)
\b
clickhouse
(?:.|[\n\r]){0,16}?
(?:ID|USER)
(?:.|[\n\r]){0,16}?
(
[a-z0-9]{20}
)
pattern_requirements:
min_digits: 2
confidence: medium
visible: false
min_entropy: 3.0
examples:
- "clickhouse_id = 4ywspD2Tb0gJh4QbLnDI"