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

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

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

      - type: word
        words:
          - "field \"aa\" not found in type: 'query_root'"
        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: 4a0a00473045022034def6328487731efa0a0eac64e0680455ec35ea07d0ae7eea87c9e7b701c1a7022100c18fa5a771f6ae8d53e5dc0e6a3d1bd540355a6a2312413a4659b0baa27c1a44:922c64590222798bb761d5b6d8e72950