Skip to content

Commit

Permalink
fix(audio_service): validate message_id format using UUID (#12087)
Browse files Browse the repository at this point in the history
Signed-off-by: -LAN- <laipz8200@outlook.com>
  • Loading branch information
laipz8200 authored Dec 25, 2024
1 parent 754791e commit a1c78ad
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/services/audio_service.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import io
import logging
import uuid
from typing import Optional

from werkzeug.datastructures import FileStorage
Expand Down Expand Up @@ -122,6 +123,10 @@ def invoke_tts(text_content: str, app_model, voice: Optional[str] = None):
raise e

if message_id:
try:
uuid.UUID(message_id)
except ValueError:
return None
message = db.session.query(Message).filter(Message.id == message_id).first()
if message is None:
return None
Expand Down

0 comments on commit a1c78ad

Please sign in to comment.