Fix DoS via sample-rate forgery bypassing audio decode duration guard (#49948)

Signed-off-by: jperezde <jperezde@redhat.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Juan Pérez de Algaba
2026-08-10 15:49:17 +00:00
committed by GitHub
co-authored by Cursor
parent 37fbf52084
commit 640a09086d
5 changed files with 126 additions and 7 deletions
@@ -126,6 +126,7 @@ class SpeechToTextBaseServing(GenerateBaseServing):
self.max_audio_filesize_mb = envs.VLLM_MAX_AUDIO_CLIP_FILESIZE_MB
self.max_audio_decode_duration_s: int = envs.VLLM_MAX_AUDIO_DECODE_DURATION_S
self.max_audio_decode_bytes: int = envs.VLLM_MAX_AUDIO_DECODE_BYTES
if self.model_cls.supports_segment_timestamp:
self.tokenizer = cast(
PreTrainedTokenizerBase,
@@ -180,6 +181,7 @@ class SpeechToTextBaseServing(GenerateBaseServing):
sr=self.asr_config.sample_rate,
mono=True,
max_duration_s=self.max_audio_decode_duration_s,
max_decode_bytes=self.max_audio_decode_bytes,
)
except ValueError:
raise