mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 01:04:32 +02:00
unauthenticated path traversal in /thumbs
Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
@@ -55,6 +55,7 @@ This release brings **Sefi-Image** and **Mage-Flow** models, plus a new **Nuncha
|
||||
- bypass sdna for caption/prompt-enhance calls
|
||||
- skip sdnq for small weights
|
||||
- server monitor keep websocket open
|
||||
- unauthenticated path traversal in /thumbs
|
||||
|
||||
## Update for 2026-07-23
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ from html.parser import HTMLParser
|
||||
from collections import OrderedDict
|
||||
import gradio as gr
|
||||
from PIL import Image
|
||||
from fastapi.exceptions import HTTPException
|
||||
from starlette.responses import FileResponse, JSONResponse
|
||||
from modules import paths, shared, devices, files_cache, errors, infotext, ui_symbols, ui_components, modelstats
|
||||
from modules.logger import log
|
||||
@@ -61,6 +62,8 @@ def init_api():
|
||||
allowed_dirs = shared.demo.allowed_paths
|
||||
if filename is None or len(filename) == 0:
|
||||
return JSONResponse({ "error": "no filename" }, status_code=400)
|
||||
if not any(Path(folder).absolute() in Path(filename).absolute().parents for folder in allowed_dirs):
|
||||
raise HTTPException(status_code=403, detail=f"file {filename}: must be in one of allowed directories")
|
||||
if not os.path.exists(filename) or not os.path.isfile(filename) or os.path.getsize(filename) == 0:
|
||||
return FileResponse('ui/assets/missing.png', headers={"Accept-Ranges": "bytes"})
|
||||
if filename.startswith('html/') or filename.startswith('models/') or filename.startswith('data/') or filename.startswith('ui/'):
|
||||
|
||||
+3
-3
@@ -29,10 +29,10 @@ safetensors==0.8.0
|
||||
peft==0.20.0
|
||||
httpx==0.28.1
|
||||
requests==2.34.2
|
||||
tqdm==4.68.3
|
||||
tqdm==4.70.0
|
||||
accelerate==1.14.0
|
||||
einops==0.8.2
|
||||
huggingface_hub==1.26.0
|
||||
huggingface_hub==1.26.1
|
||||
hf_xet==1.6.0
|
||||
numpy==2.1.2
|
||||
pandas==2.3.1
|
||||
@@ -42,7 +42,7 @@ urllib3==1.26.19
|
||||
Pillow==12.2.0
|
||||
timm==1.0.27
|
||||
pyparsing==3.3.2
|
||||
typing-extensions==4.15.0
|
||||
typing-extensions==4.16.0
|
||||
sentencepiece==0.2.1
|
||||
|
||||
# lint
|
||||
|
||||
Reference in New Issue
Block a user