Python: Add tests for py/polynomial-redos

This commit is contained in:
Rasmus Wriedt Larsen
2021-07-15 14:15:44 +02:00
parent 1be0dc0876
commit 76caf43b54
3 changed files with 13 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
edges
nodes
#select

View File

@@ -0,0 +1 @@
Security/CWE-730/PolynomialReDoS.ql

View File

@@ -0,0 +1,9 @@
import re
from flask import Flask, request
app = Flask(__name__)
@app.route("/poly-redos")
def code_execution():
text = request.args.get("text")
re.sub(r"^\s+|\s+$", "", text) # NOT OK
re.match(r"^0\.\d+E?\d+$", text) # NOT OK