[Bugfix] Bound cache_salt length to prevent DoS via scheduler CPU exhaustion (#54353)
Signed-off-by: jperezde <jperezde@redhat.com>
This commit is contained in:
@@ -141,6 +141,7 @@ class AnthropicMessagesRequest(BaseModel):
|
||||
cache_salt: str | None = Field(
|
||||
default=None,
|
||||
min_length=1,
|
||||
max_length=1024,
|
||||
description=(
|
||||
"If specified, the prefix cache will be salted with the provided "
|
||||
"string to prevent an attacker to guess prompts in multi-user "
|
||||
|
||||
@@ -467,6 +467,7 @@ class ChatCompletionRequest(OpenAIBaseModel):
|
||||
cache_salt: str | None = Field(
|
||||
default=None,
|
||||
min_length=1,
|
||||
max_length=1024,
|
||||
description=(
|
||||
"If specified, the prefix cache will be salted with the provided "
|
||||
"string to prevent an attacker to guess prompts in multi-user "
|
||||
|
||||
@@ -199,6 +199,7 @@ class CompletionRequest(OpenAIBaseModel):
|
||||
cache_salt: str | None = Field(
|
||||
default=None,
|
||||
min_length=1,
|
||||
max_length=1024,
|
||||
description=(
|
||||
"If specified, the prefix cache will be salted with the provided "
|
||||
"string to prevent an attacker to guess prompts in multi-user "
|
||||
|
||||
@@ -252,6 +252,7 @@ class ResponsesRequest(OpenAIBaseModel):
|
||||
cache_salt: str | None = Field(
|
||||
default=None,
|
||||
min_length=1,
|
||||
max_length=1024,
|
||||
description=(
|
||||
"If specified, the prefix cache will be salted with the provided "
|
||||
"string to prevent an attacker to guess prompts in multi-user "
|
||||
|
||||
@@ -82,6 +82,8 @@ class PoolingBasicRequestMixin(OpenAIBaseModel):
|
||||
)
|
||||
cache_salt: str | None = Field(
|
||||
default=None,
|
||||
min_length=1,
|
||||
max_length=1024,
|
||||
description=(
|
||||
"If specified, the prefix cache will be salted with the provided "
|
||||
"string to prevent an attacker to guess prompts in multi-user "
|
||||
|
||||
@@ -124,6 +124,7 @@ class GenerateRequest(BaseModel):
|
||||
cache_salt: str | None = Field(
|
||||
default=None,
|
||||
min_length=1,
|
||||
max_length=1024,
|
||||
description=(
|
||||
"If specified, the prefix cache will be salted with the provided "
|
||||
"string to prevent an attacker to guess prompts in multi-user "
|
||||
|
||||
Reference in New Issue
Block a user