Skip to content

fix: preserve RAG/STT config and block unsafe iframe sources - #24

Draft
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/critical-bug-investigation-402f
Draft

cursor[bot] wants to merge 2 commits into
mainfrom
cursor/critical-bug-investigation-402f

Conversation

@cursor

@cursor cursor Bot commented Aug 21, 2026

Copy link
Copy Markdown

Pull Request Checklist

Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.

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

  • Target branch: Please verify that the pull request targets the dev branch.
  • Description: Provide a concise description of the changes made in this pull request.
  • Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • Documentation: Have you updated relevant documentation Open WebUI Docs, or other documentation sources?
  • Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
  • Testing: Have you written and run sufficient tests to validate the changes?
  • 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?
  • Prefix: To clearly categorize this pull request, prefix the pull request title using one of the listed prefixes.

Changelog Entry

Description

  • Fixes critical regressions where partial RAG config updates could persistently clear upload limits, image compression settings, and the reranking model; blank STT MIME settings could disable transcription instance-wide; and generic markdown iframes could load same-origin or unsafe URLs with user credentials.

Added

  • Focused regression coverage for config helper behavior and iframe source validation.

Changed

  • Normalizes configured STT supported content types before saving or matching them.
  • Validates generic iframe sources through a shared helper before rendering.

Deprecated

  • None.

Removed

  • None.

Fixed

  • Preserves existing RAG upload limit, image compression, and reranking settings when partial /api/v1/retrieval/config/update payloads omit those fields.
  • Filters blank STT MIME entries so a default blank admin field does not store [''] and block all audio/video transcription.
  • Rejects relative, same-origin, javascript:, data:, and other non-HTTP(S) generic iframe sources in markdown rendering.

Security

  • Prevents authenticated same-origin GETs from being triggered by chat-rendered generic iframes such as /api/v1/auths/signout.
  • Prevents missing upload limits from being silently persisted by unrelated RAG config saves.

Breaking Changes

  • BREAKING CHANGE: None.

Additional Information

Bug and impact:

  • Admin web-search saves sent partial RAG config payloads; omitted file/reranking fields were stored as None, removing upload limits and corrupting RAG settings across restarts.
  • Saving Audio settings with a blank supported-MIME field stored [''], making STT MIME fallback unreachable and rejecting all transcription uploads.
  • Generic iframe rendering accepted raw markdown src values, allowing chat content to load credentialed same-origin endpoints.

Root cause:

  • Newly optional config fields were assigned directly instead of preserving existing values on partial updates.
  • STT content-type lists were not normalized on admin update or runtime matching.
  • Generic iframe rendering parsed src from unsanitized token text with no URL policy.

Fix:

  • Added small config helpers for preserving omitted values and normalizing STT MIME lists, then used them in RAG, audio, and upload processing paths.
  • Added a shared iframe source validator and regression tests.

Validation performed:

  • python3 -m pytest tests/test_config_helpers.py attempted, but pytest is not installed in the base image.
  • Manual execution of all tests/test_config_helpers.py test functions: passed.
  • python3 -m py_compile backend/open_webui/utils/config_helpers.py backend/open_webui/routers/audio.py backend/open_webui/routers/files.py backend/open_webui/routers/retrieval.py: passed.
  • npm ci: passed.
  • npx vitest run src/lib/utils/iframe.test.ts: passed (3 tests).
  • npx prettier --check src/lib/utils/iframe.ts src/lib/utils/iframe.test.ts src/lib/components/chat/Messages/Markdown/HTMLToken.svelte: passed; Prettier emitted existing pluginSearchDirs option warnings.
  • git diff --check origin/main..HEAD: passed.

Screenshots or Videos

  • Not applicable.

Contributor License Agreement

By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.

Open in Web View Automation 

cursoragent and others added 2 commits August 21, 2026 11:09
Co-authored-by: mkatwi <mkatwi@users.noreply.github.com>
Co-authored-by: mkatwi <mkatwi@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant