mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 03:18:23 -05:00
[PR #23504] [CLOSED] fix(ratingdata): add validator for model rating, forcing the value to be between 1 and 10 #66079
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/23504
Author: @lorenzophys
Created: 4/8/2026
Status: ❌ Closed
Base:
dev← Head:feedback-validation📝 Commits (2)
e657c91fix(ratingdata): add validator for model rating, forcing the value to be between 1 and 10e5cc7cfexclude everything that's not a number📊 Changes
1 file changed (+13 additions, -1 deletions)
View changed files
📝
backend/open_webui/models/feedbacks.py(+13 -1)📄 Description
Description
Problem: when giving a numeric feedback to a model, a user can skew the statistic by sending a manual request with an arbitrarily positive or negative number.
The backend should always validate inputs at the system boundary regardless of how unlikely abuse is. This was flagged by internal QA during a pentest as a medium severity finding.
Solution: I added some validation to force the numeric feedback between 1 and 10.
Note:
detailsfield is emptyAdded
detailsfield toRatingData: it reflects what the json object actually is when a rating is appliedBreaking Changes
"details": nullto the record if no rating is provided.Test
Before
curlto send the changed payloadwhere the
rating.jsonhas for exampleand you can read in the response
and you get
After
Do the same thing, but this time
results in
and
If I pass a string
I get
and in the UI I have
Contributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.