Burp Suite User Forum

Create new post

GraphQL Create Site Error (Python)

Andrzejewski, | Last updated: Jul 15, 2021 01:14PM UTC

I am getting the below error when attempting to add a site to burp enterprise via a python script. #Error "errors": [ { "message": "Variable 'input' has coerced Null value for NonNull type 'CreateSiteInput!'", "extensions": { "code": 77 #Python Script import requests import json #Query to run query = """mutation CreateSite($input: CreateSiteInput!) { create_site(input: $input){ site { id name parent_id scope { included_urls excluded_urls } } } } """ variables = { "input": { "name": "<redacted>", "parent_id": "31", "scope": { "included_urls": ["<redacted>"] }, "scan_configuration_ids": ["<redacted>"] } } # Select your transport with a defined url endpoint url = "https://<redacted>/graphql/v1" r = requests.post(url, verify=False, json={'query': query}, headers={'Authorization': '<redacted>'}) # Execute the query on the transport print(r.status_code) #print(r.text) if r.status_code == 200: print(json.dumps(r.json(), indent=2)) else: raise Exception(f"Query failed to run with a {r.status_code}.")

James, PortSwigger Agent | Last updated: Jul 19, 2021 09:58AM UTC

Hi Chris,

Apologies for the delay.

I have taken a look at your query. Not sure if you have Insomnia API client tool (free) but we find it works very well for GraphQL and testing.

I believe the main issue was it was missing the "application_logins" object.

Please try this which I just tested:

mutation CreateSite($input: CreateSiteInput!) {
create_site(input: $input) {
site {
id
name
parent_id
scope {
included_urls
excluded_urls
}
}
}
}

Query:

{
"input": {
"name": "Example Site",
"parent_id": "31",
"scope": {
"included_urls": [
"http://example.com"
],
"excluded_urls": []
},
"application_logins": {
"login_credentials": [],
"recorded_logins": []
},
"scan_configuration_ids": [
"insert-your-scan-id"
]
}
}

Let me know how you get on?

You must be an existing, logged-in customer to reply to a thread. Please email us for additional support.