id: reactapp-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
  tags: react,keys,file

file:
  - extensions:
      - all

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