[PR #24674] [CLOSED] fix(images): add null-check in upload_image to prevent crash on SSRF block #98810

Closed
opened 2026-05-16 01:40:39 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/24674
Author: @mturac
Created: 5/13/2026
Status: Closed

Base: devHead: fix/comfyui-clean


📝 Commits (1)

  • f5dcad4 fix(images): add null-check in upload_image to prevent crash on SSRF block

📊 Changes

1 file changed (+10 additions, -0 deletions)

View changed files

📝 backend/open_webui/routers/images.py (+10 -0)

📄 Description

Pull Request Checklist

Before submitting, make sure you've checked the following:

  • Linked Issue/Discussion: This PR references an existing IssueCloses #24565.
  • Target branch: Verify that the pull request targets the dev branch.
  • Description: Provide a concise description of the changes made in this pull request down below.
  • Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
  • Git Hygiene: Keep PRs atomic (one logical change). Clean up commits and rebase on dev to ensure no unrelated commits.

Changelog Entry

Fixed

  • Add null-check in upload_image to prevent crash when get_image_data returns (None, None) due to SSRF block (e.g., ComfyUI on private IP)

Description

  • When get_image_data returns (None, None) due to an SSRF block (e.g., ComfyUI on private IP like 192.168.x.x), upload_image crashed with 'NoneType' object has no attribute 'lower' in mimetypes.guess_extension
  • This is a regression from PR #24518 which added validate_url() to prevent SSRF attacks
  • Add a null-check at the start of upload_image that raises a descriptive HTTPException pointing users to the ENABLE_RAG_LOCAL_WEB_FETCH workaround

Related


Additional Information

Contributor License Agreement


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/24674 **Author:** [@mturac](https://github.com/mturac) **Created:** 5/13/2026 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `fix/comfyui-clean` --- ### 📝 Commits (1) - [`f5dcad4`](https://github.com/open-webui/open-webui/commit/f5dcad4208b4beb4451efb076c21ad6c4c798402) fix(images): add null-check in upload_image to prevent crash on SSRF block ### 📊 Changes **1 file changed** (+10 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/routers/images.py` (+10 -0) </details> ### 📄 Description # Pull Request Checklist **Before submitting, make sure you've checked the following:** - [x] **Linked Issue/Discussion:** This PR references an existing [Issue](https://github.com/open-webui/open-webui/issues) — `Closes #24565`. - [x] **Target branch:** Verify that the pull request targets the `dev` branch. - [x] **Description:** Provide a concise description of the changes made in this pull request down below. - [x] **Code review:** Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards? - [x] **Git Hygiene:** Keep PRs atomic (one logical change). Clean up commits and rebase on `dev` to ensure no unrelated commits. # Changelog Entry ### Fixed - Add null-check in `upload_image` to prevent crash when `get_image_data` returns `(None, None)` due to SSRF block (e.g., ComfyUI on private IP) ### Description - When `get_image_data` returns `(None, None)` due to an SSRF block (e.g., ComfyUI on private IP like `192.168.x.x`), `upload_image` crashed with `'NoneType' object has no attribute 'lower'` in `mimetypes.guess_extension` - This is a regression from PR #24518 which added `validate_url()` to prevent SSRF attacks - Add a null-check at the start of `upload_image` that raises a descriptive `HTTPException` pointing users to the `ENABLE_RAG_LOCAL_WEB_FETCH` workaround ### Related - Regression from #24518 - Workaround: Set `ENABLE_RAG_LOCAL_WEB_FETCH=true` --- ### Additional Information - Fixes #24565 ### Contributor License Agreement - [x] By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-16 01:40:39 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#98810