We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 74e503f commit 62634b3Copy full SHA for 62634b3
src/server/routers/ingest.py
@@ -112,7 +112,11 @@ async def download_ingest(ingest_id: str) -> FileResponse:
112
- **HTTPException**: **403** - the process lacks permission to read the directory or file
113
114
"""
115
+ # Normalize and validate the directory path
116
directory = TMP_BASE_PATH / ingest_id
117
+ directory = directory.resolve()
118
+ if not str(directory).startswith(str(TMP_BASE_PATH)):
119
+ raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail=f"Invalid ingest ID: {ingest_id!r}")
120
121
if not directory.is_dir():
122
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=f"Digest {ingest_id!r} not found")
0 commit comments