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