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,vuln

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: 4a0a00473045022100e4d8d84704f9710265f925c61b20603f38889ebed04d5b9f46bdbf2da516174e02204e5fedd1bf51bcddc288faf9bc2a7118d3fb3a8967bed30eaf6205d0f0e8b26d:922c64590222798bb761d5b6d8e72950