id: reactapp-password

info:
  name: React App Password
  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]+)*_PASS(?:\s+WORD)?\s*=\s*['"]?([^\s'"$]{6,})(?:[\s'"$]|$)
# digest: 4a0a0047304502204b1b6e6eb07b4eefc583ac6bfa6bf6f4174f789bef8d35b4aa41c99cb7ca0933022100c5ab0f9359a7080981986547db80c06d593ef4cdb9b1192d0fb8a596b652b8ca:922c64590222798bb761d5b6d8e72950