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