Skip to content

Commit ce50d9b

Browse files
committed
refac
1 parent 934bebd commit ce50d9b

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

backend/open_webui/routers/images.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
from open_webui.config import CACHE_DIR
1818
from open_webui.constants import ERROR_MESSAGES
19+
from open_webui.retrieval.web.utils import validate_url
1920
from open_webui.env import ENABLE_FORWARD_USER_INFO_HEADERS
2021

2122
from open_webui.models.chats import Chats
@@ -881,6 +882,8 @@ async def load_url_image(data):
881882
return data
882883

883884
if data.startswith("http://") or data.startswith("https://"):
885+
# Validate URL to prevent SSRF attacks against local/private networks
886+
validate_url(data)
884887
r = await asyncio.to_thread(requests.get, data)
885888
r.raise_for_status()
886889

0 commit comments

Comments
 (0)