id: grafana-key

info:
  name: Grafana API Key
  author: DhiyaneshDK
  severity: info
  reference:
    - https://github.com/returntocorp/semgrep-rules/blob/develop/generic/secrets/gitleaks/grafana-api-key.yaml
    - https://github.com/returntocorp/semgrep-rules/blob/develop/generic/secrets/gitleaks/grafana-api-key.go
    - https://grafana.com/docs/grafana/latest/developers/http_api/auth/
  metadata:
    verified: true
    max-request: 1
  tags: grafana,exposure,tokens

http:
  - method: GET
    path:
      - "{{BaseURL}}"

    extractors:
      - type: regex
        part: body
        regex:
          - (?i)\b(eyJrIjoi[A-Za-z0-9]{70,400}={0,2})(?:['|\"|\n|\r|\s|\x60|;]|$)
# digest: 4a0a0047304502206a367f8817a90b8e45416f1eb71289fd8de91c470c7d0596566c07dae9ed21c2022100db393c53d1b9b0f803560e580ee59176171a0d2958ede8d6930a1e6b4e336811:922c64590222798bb761d5b6d8e72950