Skip to content

Commit ea1c531

Browse files
Prevent DDoS attacks by limiting the size of the graph
1 parent ad011ec commit ea1c531

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

pytact/graph_visualize_browse.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class Settings:
4848
max_size: int = 100
4949

5050
def __post_init__(self):
51+
self.max_size = min(10000, self.max_size) # Prevent DDoS attacks by limiting the size of the graph
5152
if not self.no_defaults:
5253
self.ignore_edges = [graph_api_capnp.EdgeClassification.schema.enumerants['constOpaqueDef']]
5354
label = graph_api_capnp.Graph.Node.Label

pytact/templates/visualizer.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180
<div class="field">
181181
<div class="ui grid">
182182
<div class="five wide column">
183-
<input type="number" id="max_size" name="max_size" min="1"
183+
<input type="number" id="max_size" name="max_size" min="1" max="10000"
184184
style="width:5.5rem" value="{{ settings.max_size }}">
185185
</div>
186186
<div class="eleven wide column middle aligned">

0 commit comments

Comments
 (0)