Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(audio_service): validate message_id format using UUID #12087

Merged
merged 1 commit into from
Dec 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading