Skip to content

Commit

Permalink
Add pg_graphql
Browse files Browse the repository at this point in the history
  • Loading branch information
dolevf committed Dec 26, 2023
1 parent d141a1a commit 5ceb004
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ graphw00f currently attempts to discover the following GraphQL engines:
* jaal - Golang
* absinthe-graphql - Elixir
* GraphQL.NET - Microsoft .NET
* pg_graphql - Rust

# GraphQL Threat Matrix
The graphw00f project uses the [GraphQL Threat Matrix Project](https://github.com/nicholasaleks/graphql-threat-matrix/) as its technology security matrix database. When graphw00f successfully fingerprints a GraphQL endpoint, it will print out the threat matrix document. This document helps security engineers to identify how mature the technology is, what security features it offers, and whether it contains any CVEs.
Expand Down
9 changes: 8 additions & 1 deletion graphw00f/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ def possible_graphql_paths():
'/playground',
'/gql',
'/query',
'/index.php?graphql'
'/index.php?graphql',
'/rpc/graphql'
]

def get_engines():
Expand Down Expand Up @@ -268,6 +269,12 @@ def get_engines():
'ref':'https://github.com/nicholasaleks/graphql-threat-matrix/blob/master/implementations/graphql-dotnet.md',
'technology':['C#', '.NET']
},
'pg_graphql':{
'name':'pg_graphql',
'url':'https://supabase.github.io/pg_graphql',
'ref':'https://github.com/nicholasaleks/graphql-threat-matrix/blob/master/implementations/pg_graphql.md' ,
'technology':['Rust']
}
}

def user_confirmed(choice):
Expand Down
17 changes: 14 additions & 3 deletions graphw00f/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ def execute(self, url):
return 'absinthe-graphql'
elif self.engine_graphqldotnet():
return 'graphql-dotnet'
elif self.engine_pggraphql():
return 'pg_graphql'

return None

Expand Down Expand Up @@ -695,6 +697,15 @@ def engine_absinthe(self):
return False

def engine_graphqldotnet(self):
query = 'query @skip { __typename }'
response = self.graph_query(self.url, payload=query)
return error_contains(response, 'Directive \'skip\' may not be used on Query.')
query = 'query @skip { __typename }'
response = self.graph_query(self.url, payload=query)
return error_contains(response, 'Directive \'skip\' may not be used on Query.')

def engine_pggraphql(self):
query = '''query { __typename @skip(aa:true) }
'''
response = self.graph_query(self.url, payload=query)
if error_contains(response, 'Unknown argument to @skip: aa'):
return True

return False
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = '1.1.14'
VERSION = '1.1.15'

0 comments on commit 5ceb004

Please sign in to comment.