[PR #22429] [CLOSED] fix: prevent pipeline filter from corrupting chat payload on HTTP error #49734

Closed
opened 2026-04-30 02:02:42 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/22429
Author: @alvinttang
Created: 3/8/2026
Status: Closed

Base: mainHead: fix/pipeline-filter-payload-corruption


📝 Commits (1)

  • ff9aaa8 fix: prevent pipeline filter from corrupting payload on HTTP error

📊 Changes

1 file changed (+2 additions, -2 deletions)

View changed files

📝 backend/open_webui/routers/pipelines.py (+2 -2)

📄 Description

Summary

In both the inlet and outlet pipeline filter processing, response.json() was called before response.raise_for_status(). When a filter endpoint returns an HTTP error (4xx/5xx), the user's chat payload gets silently overwritten with the error response body.

Impact

If a pipeline filter returns an error:

  1. The user's chat payload (containing messages, model, etc.) is replaced with the error response
  2. If the error is swallowed (e.g., by the broad except Exception handler that just logs), the corrupted payload propagates to subsequent filters and ultimately to the chat completion endpoint
  3. This causes confusing downstream failures with no indication that data corruption occurred

Fix

Swapped the call order in both process_pipeline_inlet_filter and process_pipeline_outlet_filter:

# Before (wrong order)
payload = await response.json()     # overwrites payload with error body
response.raise_for_status()         # raises too late

# After (correct order)
response.raise_for_status()         # raises before payload is touched
payload = await response.json()     # only runs on success

🔄 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/22429 **Author:** [@alvinttang](https://github.com/alvinttang) **Created:** 3/8/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/pipeline-filter-payload-corruption` --- ### 📝 Commits (1) - [`ff9aaa8`](https://github.com/open-webui/open-webui/commit/ff9aaa8954f8d2d580b8f7414a76425f06232652) fix: prevent pipeline filter from corrupting payload on HTTP error ### 📊 Changes **1 file changed** (+2 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/routers/pipelines.py` (+2 -2) </details> ### 📄 Description ## Summary In both the inlet and outlet pipeline filter processing, `response.json()` was called **before** `response.raise_for_status()`. When a filter endpoint returns an HTTP error (4xx/5xx), the user's chat payload gets silently overwritten with the error response body. ### Impact If a pipeline filter returns an error: 1. The user's chat `payload` (containing messages, model, etc.) is replaced with the error response 2. If the error is swallowed (e.g., by the broad `except Exception` handler that just logs), the corrupted payload propagates to subsequent filters and ultimately to the chat completion endpoint 3. This causes confusing downstream failures with no indication that data corruption occurred ### Fix Swapped the call order in both `process_pipeline_inlet_filter` and `process_pipeline_outlet_filter`: ```python # Before (wrong order) payload = await response.json() # overwrites payload with error body response.raise_for_status() # raises too late # After (correct order) response.raise_for_status() # raises before payload is touched payload = await response.json() # only runs on success ``` --- <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-04-30 02:02:42 -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#49734