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

60 lines
No EOL
1.6 KiB
YAML

rules:
- name: Artifactory Access Token
id: kingfisher.artifactory.1
pattern: |
(?xi)
\b
(
AKC[A-Z0-9]{64,74}
)
\b
pattern_requirements:
min_digits: 2
min_uppercase: 1
min_lowercase: 1
min_entropy: 3.5
confidence: medium
examples:
- |
export HOMEBREW_ARTIFACTORY_API_TOKEN=AKCp8igrDNFerC357m4422e4tmu7xB983QLPxJhKFcSMfoux2RFvp8rc4jC8t9ncdmYCMFD8W
export HOMEBREW_ARTIFACTORY_API_USER=kashorn
- 'jfrog rt dl --url=http://localhost:8071/artifactory --apikey=AKCp2WXX7SDvcsmny528sSDnaB3zACkNQoRcD8D1WmxhMV9gk6Wp8mVWC8bh38kJQbXagUT8Z generic-local/hello.txt'
validation:
type: Http
content:
request:
headers:
X-JFrog-Art-Api: '{{ TOKEN }}'
method: GET
response_matcher:
- report_response: true
- status:
- 200
type: StatusMatch
- type: JsonValid
url: https://{{ JFROGURL }}/artifactory/api/repositories
depends_on_rule:
- rule_id: "kingfisher.artifactory.2"
variable: JFROGURL
- name: Artifactory JFrog URL
id: kingfisher.artifactory.2
pattern: |
(?xi)
\b
(
[a-z0-9]
(?:
[a-z0-9\-]{0,61}
[a-z0-9]
)?
\.jfrog\.io
)
\b
min_entropy: 3.5
visible: false
confidence: medium
examples:
- mycompany.jfrog.io
- my-company-name.jfrog.io
- a.jfrog.io