forked from ShiftLeftSecurity/shiftleft-python-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrecursive.py
More file actions
32 lines (23 loc) · 855 Bytes
/
Copy pathrecursive.py
File metadata and controls
32 lines (23 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from flask import Flask, request
app = Flask(__name__)
def recur_without_any_propagation(x):
if len(x) < 20:
return recur_without_any_propagation("a" * 24)
return "Done"
def recur_no_propagation_false_positive(x):
if len(x) < 20:
return recur_no_propagation_false_positive(x + "!")
return "Done"
def recur_with_propagation(x):
if len(x) < 20:
return recur_with_propagation(x + "!")
return x
@app.route('/recursive')
def route():
param = request.args.get('param', 'not set')
repeated_completely_untainted = recur_without_any_propagation(param)
app.db.execute(repeated_completely_untainted)
repeated_untainted = recur_no_propagation_false_positive(param)
app.db.execute(repeated_untainted)
repeated_tainted = recur_with_propagation(param)
app.db.execute(repeated_tainted)