Skip to content

Commit 430bfb5

Browse files
ShreeShree
authored andcommitted
test: add SAST dataflow fixtures
1 parent ef3486e commit 430bfb5

4 files changed

Lines changed: 30 additions & 0 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
app.get("/search", async (req, res) => {
2+
const q = parseSearchTerm(req.query.q);
3+
const rows = await db("tickets").where("title", "like", `%${q}%`);
4+
res.json(rows);
5+
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from flask import request
2+
import subprocess
3+
4+
5+
def validate_report_id(value: str) -> str:
6+
if not value.isdecimal():
7+
raise ValueError("invalid report id")
8+
return value
9+
10+
11+
def export_report():
12+
report_id = validate_report_id(request.args["id"])
13+
subprocess.run(["report-cli", "--id", report_id], check=True)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from flask import request
2+
import subprocess
3+
4+
5+
def export_report():
6+
report_id = request.args["id"]
7+
subprocess.run(f"report-cli --id {report_id}", shell=True, check=True)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
app.get("/search", async (req, res) => {
2+
const where = buildWhereClause(req.query.q);
3+
const rows = await db.raw(`select * from tickets where ${where}`);
4+
res.json(rows);
5+
});

0 commit comments

Comments
 (0)