id: javascript-env

info:
  name: JavaScript Environment Configuration - Detect
  author: pdp,geeknik,hetyh
  severity: low
  description: Multiple common JavaScript environment configuration files were detected.
  metadata:
    max-request: 7
  tags: javascript,config,exposure

http:
  - method: GET
    path:
      - "{{BaseURL}}/env.js"
      - "{{BaseURL}}/env.development.js"
      - "{{BaseURL}}/env.production.js"
      - "{{BaseURL}}/env.test.js"
      - "{{BaseURL}}/env.dev.js"
      - "{{BaseURL}}/env.prod.js"
      - "{{BaseURL}}/__ENV.js"

    stop-at-first-match: true
    matchers-condition: and
    matchers:
      - type: status
        status:
          - 200

      - type: dsl
        dsl:
          - "contains(tolower(content_type), 'application/javascript')"

      - type: word
        part: body
        words:
          - "module.exports"
          - "const audience"
          - "const domain"
          - "NODE_ENV"
          - "LOG_LEVEL"
          - "TOKEN"
          - "KEY"
          - "PASSWORD"
          - "VERSION"
          - "window.__ENV ="
        condition: or

      - type: word
        part: body
        words:
          - "Bootstrap"
          - "jQuery"
          - "CSS TRANSITION SUPPORT"
          - "is_ad_blocked"
        condition: or
        negative: true
# digest: 4a0a00473045022052ce46d4d02595856cd4386419e8f89a77ae4b5727b3f3ebeb9133daa84d3c79022100cae1bdf939db3c21bfeefa11183501a12dc0da0e8501bc55d9c8dd36ca85c784:922c64590222798bb761d5b6d8e72950