Skip to content

Commit 436152a

Browse files
committed
Python: Refactor flask file sending tests
1 parent e889568 commit 436152a

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from flask import send_from_directory, send_file
2+
3+
send_from_directory("filepath", "file") # $ getAPathArgument="filepath" getAPathArgument="file"
4+
send_from_directory(directory="filepath", filename="file") # $ getAPathArgument="filepath" getAPathArgument="file"
5+
6+
send_file("file") # $ getAPathArgument="file"
7+
send_file(filename_or_fp="file") # $ getAPathArgument="file"
Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
1-
from flask import Flask, request, send_from_directory, send_file
1+
from flask import Flask, request
22
app = Flask(__name__)
33

44
@app.route("/save-uploaded-file") # $routeSetup="/save-uploaded-file"
55
def test_taint(): # $requestHandler
66
request.files['key'].save("path") # $ getAPathArgument="path"
7-
8-
9-
@app.route("/path-injection") # $routeSetup="/path-injection"
10-
def test_path(): # $requestHandler
11-
12-
send_from_directory("filepath","file") # $ getAPathArgument="filepath" getAPathArgument="file"
13-
send_file("file") # $ getAPathArgument="file"
14-
15-
send_from_directory(directory="filepath","file") # $ getAPathArgument="filepath" getAPathArgument="file"
16-
send_from_directory(filename="filepath","file") # $ getAPathArgument="filepath" getAPathArgument="file"
17-
send_file(filename_or_fp="file") # $ getAPathArgument="file"

0 commit comments

Comments
 (0)