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: 4a0a00473045022100b7f6082bae42aa175132ebc8b08e106849e20c4c66c581d3f624cc9d357f321f022038aebd86230dd34714907a6adaec0a024549ab0d07e2bb7931927774be025493:922c64590222798bb761d5b6d8e72950