Skip to content

Commit

Permalink
Prevent DDoS attacks by limiting the size of the graph
Browse files Browse the repository at this point in the history
  • Loading branch information
LasseBlaauwbroek committed Oct 30, 2023
1 parent ad011ec commit ea1c531
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions pytact/graph_visualize_browse.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class Settings:
max_size: int = 100

def __post_init__(self):
self.max_size = min(10000, self.max_size) # Prevent DDoS attacks by limiting the size of the graph
if not self.no_defaults:
self.ignore_edges = [graph_api_capnp.EdgeClassification.schema.enumerants['constOpaqueDef']]
label = graph_api_capnp.Graph.Node.Label
Expand Down
2 changes: 1 addition & 1 deletion pytact/templates/visualizer.html
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
<div class="field">
<div class="ui grid">
<div class="five wide column">
<input type="number" id="max_size" name="max_size" min="1"
<input type="number" id="max_size" name="max_size" min="1" max="10000"
style="width:5.5rem" value="{{ settings.max_size }}">
</div>
<div class="eleven wide column middle aligned">
Expand Down

0 comments on commit ea1c531

Please sign in to comment.