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

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: 490a0046304402203228bc7b46675e92256568f16b7267abc498b174617c5839e183fe456a83e26e02207d2c54fec88dfc82c42818df5b10ff04d13bc50fe84f548368e964dbf5e0e93b:922c64590222798bb761d5b6d8e72950