-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
dolevf
committed
Apr 28, 2022
1 parent
40e8482
commit f724a8a
Showing
3 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
"""Circular Fragment tests.""" | ||
from lib.utils import graph_query, curlify | ||
|
||
|
||
def circular_fragment(url, proxy, headers): | ||
"""Check for circular fragment.""" | ||
res = { | ||
'result':False, | ||
'title':'Circular Fragment', | ||
'description':'Circular Fragment allowed in Query', | ||
'impact':'Denial of Service', | ||
'severity':'HIGH', | ||
'curl_verify':'' | ||
} | ||
|
||
q = ''' | ||
query { | ||
__schema { | ||
...A | ||
} | ||
} | ||
fragment A on __Schema { | ||
__typename | ||
...B | ||
} | ||
fragment B on __Schema { | ||
...A | ||
} | ||
''' | ||
gql_response = graph_query(url, proxies=proxy, headers=headers, payload=q) | ||
res['curl_verify'] = curlify(gql_response) | ||
|
||
try: | ||
print(gql_response.json()) | ||
if not 'errors' in gql_response.json(): | ||
res['result'] = True | ||
except: | ||
pass | ||
|
||
return res |