diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b18982c6..159358ea5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/modules/ui_extra_networks.py b/modules/ui_extra_networks.py index 0c7ad35a5..ac8f1c684 100644 --- a/modules/ui_extra_networks.py +++ b/modules/ui_extra_networks.py @@ -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/'): diff --git a/requirements.txt b/requirements.txt index 2e9189da3..27717958c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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