id: npmrc-authtoken

info:
  name: Hardcoded .npmrc AuthToken
  author: geeknik
  severity: info
  reference:
    - https://docs.npmjs.com/cli/v8/configuring-npm/npmrc
    - https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry
  metadata:
    verified: true
    max-request: 1
    google-query: intitle:"index of" ".npmrc"
  tags: npm,exposure,vuln

http:
  - method: GET
    path:
      - "{{BaseURL}}/.npmrc"

    matchers-condition: and
    matchers:
      - type: word
        words:
          - "_authToken="
          - "_auth="
        condition: or

      - type: word
        part: header
        words:
          - "text/html"
          - "application/javascript"
          - "application/json"
        negative: true

      - type: status
        status:
          - 200
# digest: 4a0a00473045022100f6aabb488d163461e4775b67c5328dae27b45b476ff35065fd75d59cfc10ad7402202ce32289fb37650446036a6928f3b3f3f33a3ef14205aeb2747ce3af90f8b79e:922c64590222798bb761d5b6d8e72950