id: graphql-apollo-detect
info:
  name: Graphql Apollo Detect
  author: princechaddha
  severity: info
  reference: https://github.com/dolevf/graphw00f/blob/main/graphw00f/lib.py
  tags: tech,graphql,apollo

http:
  - method: POST
    path:
      - "{{BaseURL}}/graphql"
      - "{{BaseURL}}/api/graphql"
      - "{{BaseURL}}/query"
      - "{{BaseURL}}/"
    body: '{"query":"query @skip {__typename}"}'
    headers:
      Content-Type: application/json
    redirects: true

    matchers-condition: and
    matchers:
      - type: status
        status:
          - 200

      - type: word
        words:
          - 'Directive "@skip" argument "if" of type "Boolean!" is required, but it was not provided.'
        part: body

      - type: word
        words:
          - 'Content-Type: text/html'
        part: header
        negative: true

      - type: word
        words:
          - '<html'
          - '<body'
        part: body
        condition: or
        negative: true
# digest: 490a0046304402201d377bb2eac80566ec4865ab5cc6e71b657fab3e5d6b8316d19544f1323dc3ed0220545134edc7b74f5bdaaadee484aa8f8f354f42ee0a44e9f12c08c768a27307c3:922c64590222798bb761d5b6d8e72950