id: react-app-username

info:
  name: React App Username
  author: DhiyaneshDK
  severity: info
  reference:
    - https://github.com/praetorian-inc/noseyparker/blob/main/crates/noseyparker/data/default/builtin/rules/react.yml
    - https://create-react-app.dev/docs/adding-custom-environment-variables/
    - https://stackoverflow.com/questions/48699820/how-do-i-hide-an-api-key-in-create-react-app
  metadata:
    verified: true
    max-request: 1
  tags: react,exposure,tokens

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

    extractors:
      - type: regex
        part: body
        regex:
          - \bREACT_APP(?:_[A-Z0-9]+)*_USER(?:\s+NAME)?\s*=\s*['"]?([^\s'"$]{3,})(?:[\s'"$]|$)
# digest: 4a0a00473045022029038675b3606e3fbbf543838527fd97cde703a7caa3a3db83fc3afc7d07747f022100c41711222ef8097e3ae15f29b71a16d5681692f9bf5f0a27062d686f85d4db42:922c64590222798bb761d5b6d8e72950