Skip to content

Commit 387225e

Browse files
authored
fix: suppress internal path leakage in audio transcription errors (GHSA-vvxm-vxmr-624h) (open-webui#22108)
- Use os.path.basename() for filename sanitization instead of fragile blocklist - Replace ERROR_MESSAGES.DEFAULT(e) with generic error message in both except blocks to prevent CWE-209 information disclosure - Server-side logging via log.exception(e) is preserved for debugging
1 parent c83a421 commit 387225e

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

backend/open_webui/routers/audio.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,8 +1194,8 @@ def transcription(
11941194
)
11951195

11961196
try:
1197-
ext = file.filename.split(".")[-1] if file.filename else ""
1198-
ext = ext.replace("/", "").replace("\\", "").replace("..", "")
1197+
safe_name = os.path.basename(file.filename) if file.filename else ""
1198+
ext = safe_name.rsplit(".", 1)[-1] if "." in safe_name else ""
11991199

12001200
id = uuid.uuid4()
12011201

@@ -1231,15 +1231,15 @@ def transcription(
12311231

12321232
raise HTTPException(
12331233
status_code=status.HTTP_400_BAD_REQUEST,
1234-
detail=ERROR_MESSAGES.DEFAULT(e),
1234+
detail="Transcription failed.",
12351235
)
12361236

12371237
except Exception as e:
12381238
log.exception(e)
12391239

12401240
raise HTTPException(
12411241
status_code=status.HTTP_400_BAD_REQUEST,
1242-
detail=ERROR_MESSAGES.DEFAULT(e),
1242+
detail="Transcription failed.",
12431243
)
12441244

12451245

0 commit comments

Comments
 (0)