id: package-json

info:
  name: NPM package.json Disclosure
  author: geeknik,afaq,noraj
  severity: info
  description: |
    All NodeJS packages contain a file, usually in the project root, called package.json - this file holds various metadata relevant to the project generated by package managers such as npm, yarn, pnpm.
  reference:
    - https://docs.npmjs.com/cli/v9/configuring-npm/package-json
    - https://classic.yarnpkg.com/lang/en/docs/package-json/
    - https://pnpm.io/package_json
  classification:
    cwe-id: CWE-552
  metadata:
    verified: true
    max-request: 2
  tags: config,exposure,node,npm,vuln

http:
  - method: GET
    path:
      - "{{BaseURL}}/package.json"
      - "{{BaseURL}}/package-lock.json"

    matchers-condition: and
    matchers:
      - type: word
        words:
          - "name"
          - "version"
        condition: and

      - type: word
        part: header
        words:
          - "application/json"

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