fix: return filename instead of absolute path in upload responses
This commit is contained in:
parent
31e210c7e3
commit
209643becb
1 changed files with 13 additions and 0 deletions
|
|
@ -237,3 +237,16 @@ class TestUpload:
|
||||||
headers=_h(client["admin"]),
|
headers=_h(client["admin"]),
|
||||||
)
|
)
|
||||||
assert resp.status_code == 413
|
assert resp.status_code == 413
|
||||||
|
|
||||||
|
def test_upload_does_not_leak_absolute_path(self, client):
|
||||||
|
"""Upload response should not contain absolute filesystem paths."""
|
||||||
|
import io
|
||||||
|
resp = client["client"].post(
|
||||||
|
"/api/upload/artifacts",
|
||||||
|
files={"file": ("test.txt", io.BytesIO(b"hello"), "text/plain")},
|
||||||
|
headers=_h(client["admin"]),
|
||||||
|
)
|
||||||
|
assert resp.status_code == 200
|
||||||
|
data = resp.json()
|
||||||
|
assert not data.get("path", "").startswith("/"), "Response should not leak absolute path"
|
||||||
|
assert "filename" in data, "Response should contain filename"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue