(security) Enforce audio upload size limit before full file materialization (#45510)
Signed-off-by: jperezde <jperezde@redhat.com>
This commit is contained in:
@@ -13,6 +13,7 @@ from vllm.entrypoints.serve.utils.api_utils import (
|
||||
load_aware_call,
|
||||
with_cancellation,
|
||||
)
|
||||
from vllm.entrypoints.speech_to_text.base.utils import read_upload_with_limit
|
||||
from vllm.logger import init_logger
|
||||
|
||||
from .protocol import TranslationRequest, TranslationResponseVariant
|
||||
@@ -45,7 +46,7 @@ async def create_translations(
|
||||
if handler is None:
|
||||
raise NotImplementedError("The model does not support Translations API")
|
||||
|
||||
audio_data = await request.file.read()
|
||||
audio_data = await read_upload_with_limit(request.file)
|
||||
|
||||
generator = await handler.create_translation(audio_data, request, raw_request)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user