Skip to content

Commit

Permalink
add security advise
Browse files Browse the repository at this point in the history
  • Loading branch information
devkral committed Mar 21, 2024
1 parent 77fe526 commit 863f413
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,19 @@ Note: graphql itself will fail because they are not using a stack free approach.
looks nice but very hard to implement. Handling costs at client and server side synchronously is complicated.
Also the costs are baked into the schema, which crosses the boundary between static and dynamic

# Security Advise

Please note, that this project doesn't prevent resource exhaustion attacks by using a huge amount of tokens. This project
prevents attacks after the string has been parsed to a node graph.

Please see token limiter (e.g. strawberry.extensions TokenLimiter) for that purpose. Or set manually the token limit to an appropiate value
e.g. 1000 (ExecutionContext), see the strawbbery extension for an example

Note also, that because of the recursive parsing of strings, there is the possibility to cause an exception
by using very deep graphs (> 200 level).
Because this attack is also taking place while string parsing (string to graph), I cannot stop it.
The effects are very limitted because of the security features of python (stops after 1000 level depth) and returns an exception which stops the graph parsing

# TODO

- manually construct the graphql tree for tests for check_resource_usage
Expand Down

0 comments on commit 863f413

Please sign in to comment.