kingfisher/crates/kingfisher-rules/data/rules/midtrans.yml
2026-04-03 23:43:49 -07:00

78 lines
2 KiB
YAML

rules:
- name: Midtrans Sandbox Server/Client Key
id: kingfisher.midtrans.1
pattern: |
(?x)
\b
(
SB-Mid-(?:server|client)-
[A-Za-z0-9_]{10,20}
)
\b
pattern_requirements:
min_digits: 2
min_entropy: 2.8
confidence: high
examples:
- "MIDTRANS_SERVER_KEY=\"SB-Mid-server-Xk93PcDP8pMKfhY2\""
- "midtrans_client_key = 'SB-Mid-client-py_WqVmIjA462VHz'"
references:
- https://docs.midtrans.com
validation:
type: Http
content:
request:
method: GET
url: https://api.sandbox.midtrans.com/v2/fake-order-id/status
headers:
Authorization: "Basic {{ TOKEN }}"
Accept: application/json
response_matcher:
- report_response: true
- type: StatusMatch
status: [200, 404]
- type: StatusMatch
status: [401, 403]
negative: true
- name: Midtrans Production Server/Client Key
id: kingfisher.midtrans.2
pattern: |
(?xi)
\b
(?:midtrans|mid[_-]?)
(?:.|[\n\r]){0,32}?
\b(?:server[_-]?key|client[_-]?key|api[_-]?key|key)\b
(?:.|[\n\r]){0,16}?
[=:"'\s]
\b
(
Mid-(?:server|client)-
[A-Za-z0-9_]{10,20}
)
\b
pattern_requirements:
min_digits: 2
min_entropy: 2.8
confidence: high
examples:
- "midtrans\nserver_key=\"Mid-server-Xk93PcDP8pMKfhY2\""
- "midtrans.client_key = 'Mid-client-Xk93PcDP8pMKfhY2'"
references:
- https://docs.midtrans.com
validation:
type: Http
content:
request:
method: GET
url: https://api.midtrans.com/v2/fake-order-id/status
headers:
Authorization: "Basic {{ TOKEN }}"
Accept: application/json
response_matcher:
- report_response: true
- type: StatusMatch
status: [200, 404]
- type: StatusMatch
status: [401, 403]
negative: true