[Security] Fix chat template resource-exhaustion DoS (GHSA-4hhp-h66f-… (#50300)
Signed-off-by: jperezde <jperezde@redhat.com> Signed-off-by: Juan Pérez de Algaba <jperezde@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
fc2c801ad9
commit
cff08b461e
@@ -334,6 +334,16 @@ class OpenAIServingResponses(GenerateBaseServing):
|
||||
if maybe_validation_error is not None:
|
||||
return maybe_validation_error
|
||||
|
||||
maybe_template_error = self.online_renderer.validate_chat_template(
|
||||
request_chat_template=None,
|
||||
chat_template_kwargs=request.chat_template_kwargs,
|
||||
trust_request_chat_template=(
|
||||
self.online_renderer.trust_request_chat_template
|
||||
),
|
||||
)
|
||||
if maybe_template_error is not None:
|
||||
return maybe_template_error
|
||||
|
||||
self._preflight()
|
||||
|
||||
if request.store and not self.enable_store:
|
||||
|
||||
Reference in New Issue
Block a user