Test getFile inner_path security
This commit is contained in:
parent
f4f0e2afa8
commit
8185f4dfda
1 changed files with 6 additions and 0 deletions
|
@ -48,6 +48,12 @@ class TestFileRequest:
|
|||
response = connection.request("getFile", {"site": site.address, "inner_path": "content.json", "location": 0, "file_size": 1234})
|
||||
assert "File size does not match" in response["error"]
|
||||
|
||||
# Invalid path
|
||||
for path in ["../users.json", "./../users.json", "data/../content.json", ".../users.json"]:
|
||||
for sep in ["/", "\\"]:
|
||||
response = connection.request("getFile", {"site": site.address, "inner_path": path.replace("/", sep), "location": 0})
|
||||
assert response["error"] == 'File read exception'
|
||||
|
||||
connection.close()
|
||||
client.stop()
|
||||
|
||||
|
|
Loading…
Reference in a new issue