id: sendgrid-api-key

info:
  name: Sendgrid API Key Disclosure
  author: Ice3man,DhiyaneshDK
  severity: info
  reference:
    - https://github.com/semgrep/semgrep-rules/blob/develop/generic/secrets/gitleaks/sendgrid-api-token.go
    - https://github.com/semgrep/semgrep-rules/blob/develop/generic/secrets/gitleaks/sendgrid-api-token.yaml
    - https://docs.sendgrid.com/ui/account-and-settings/api-keys
  classification:
    cwe-id: CWE-522,CWE-540
  metadata:
    max-request: 1
  tags: exposure,token,sendgrid,vuln

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

    extractors:
      - type: regex
        part: body
        regex:
          - (?i)\b(SG\.(?i)[a-z0-9=_\-\.]{66})(?:['|\"|\n|\r|\s|\x60|;]|$)
# digest: 4a0a00473045022008de1e31d52e47d85196284a9c75026d1c996835cd7b101fe5e106a7a2ac1497022100a88325e271661ee7f77c6bc5a8563ef69981f87d78f6df8ad3e3e506c16a7877:922c64590222798bb761d5b6d8e72950