]> git.ipfire.org Git - pbs.git/commitdiff
api: packages: Prevent files from being downloaded that are not downloadable
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 10 Jul 2025 15:06:29 +0000 (15:06 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 10 Jul 2025 15:06:29 +0000 (15:06 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/api/packages.py

index 456a4d3b2cc50e28ea501e02d69ea79d059f5286..e18ca055e5872d3f6bea28406f60cee6050206be 100644 (file)
@@ -109,7 +109,9 @@ async def download_file(
        if not file:
                raise fastapi.HTTPException(404, "Could not find file %s in %s" % (path, package))
 
-       # XXX Check if this is actually downloadable
+       # Check if this is actually downloadable
+       if not file.is_downloadable():
+               raise fastapi.HTTPException(400, "File is not downloadable")
 
        return fastapi.responses.StreamingResponse(file.stream(), headers=file.headers)