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

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

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

      - type: word
        words:
          - 'Syntax error while parsing GraphQL query. Invalid input "queryy", expected ExecutableDefinition or TypeSystemDefinition'
        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: 4a0a00473045022100d8fcff50cfe306e145cc2b5e774f517c0f941c6ca58b7ee3b0f1d28b32f57aca0220518f016bda214643f5201175b22ee8a32ab8e175d2e13d710cc8c0b562a77d9d:922c64590222798bb761d5b6d8e72950