Skip to content

Commit 665f95e

Browse files
committed
refac
1 parent 8e2b0b6 commit 665f95e

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

backend/open_webui/utils/files.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from open_webui.models.chats import Chats
1919
from open_webui.models.files import Files
2020
from open_webui.routers.files import upload_file_handler
21+
from open_webui.retrieval.web.utils import validate_url
2122

2223
import mimetypes
2324
import base64
@@ -33,6 +34,8 @@
3334
def get_image_base64_from_url(url: str) -> Optional[str]:
3435
try:
3536
if url.startswith("http"):
37+
# Validate URL to prevent SSRF attacks against local/private networks
38+
validate_url(url)
3639
# Download the image from the URL
3740
response = requests.get(url)
3841
response.raise_for_status()

0 commit comments

Comments
 (0)