Repository navigation
[Security] Reject reserved transfer keys in vllm_xargs - #56814
Open
jperezdealgaba wants to merge 1 commit into
Open
jperezdealgaba wants to merge 1 commit into
jperezdealgaba wants to merge 1 commit into
Conversation
Co-authored-by: Cursor Agent Signed-off-by: Juan Pérez de Algaba <jperezde@redhat.com>
jperezdealgaba
requested review from
AndreasKaratzas,
BugenZhao,
DarkLight1337,
NickLucche,
aarnphm,
chaunceyjiang,
njhill,
robertgshaw2-redhat and
russellb
as code owners
September 14, 2026 10:50
Contributor
|
This pull request has merge conflicts that must be resolved before it can be |
This was referenced Oct 19, 2026
5 of 6 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OpenAI request conversion copies caller-controlled
vllm_xargsintoSamplingParams.extra_argsand only overlays typedkv_transfer_params/ec_transfer_paramswhen those top-level fields are present. Planting a reserved key insidevllm_xargs(including a non-dict) therefore reaches EngineCore, where connectors call.get()and the process dies. This change rejects reserved transfer keys at the API merge, type-checks them onSamplingParams, and stores only dicts onRequestso EngineCore does not crash if extra_args is mutated after construction.Changes
vllm/sampling_params.py: sharedmerge_request_extra_argsthat copies xargs, rejects reserved keys, then overlays typed fields;_verify_extra_argsrequires those keys to be dicts.vllm/v1/request.py: keep kv/ec transfer params only when they are dicts (do not raise in EngineCore).Codepath coverage
/v1/completions,/v1/chat/completions(including batch),/v1/responses,/v1/messages(via ChatCompletionRequest),/invocations, STT transcription/translation, Rust HTTP completions/chat/generate, offlineSamplingParams, and EngineCoreRequestconstruction.Duplicate-work check
Searched open and merged PRs for
vllm_xargs,kv_transfer_params, and extra_args merge. #50353 copiesvllm_xargsto avoid mutating the request dict but still overlays reserved keys and does not reject them. #55182 type-checks nested P2P role dicts only. Neither closes this sink.Tests
test_completion_rejects_reserved_xargs_key/ chat / responses: reserved keys invllm_xargsraiseVLLMValidationError.test_merge_request_extra_args_overlays_typed_fieldsandtest_completion_overlays_typed_kv_transfer_params: typed overlay still works;kv_cache_report_modeis not reserved.test_completion_does_not_mutate_request_xargs: overlay does not mutate the request dict.test_extra_args_rejects_non_dict_transfer_params:SamplingParamsrejects non-dict transfer blobs.test_request_ignores_non_dict_transfer_params: EngineCore storesNoneinstead of crashing.merge_kv_rejects_reserved_xargs_key,merge_ec_rejects_reserved_xargs_key,merge_kv_overlays_typed_field.Commands:
.venv/bin/python -m pytest tests/test_sampling_params.py tests/v1/test_request.py tests/entrypoints/openai/test_xargs_transfer_params.py tests/entrypoints/openai/test_protocol_responses.py tests/entrypoints/anthropic/test_anthropic.py tests/v1/ec_connector/unit/test_ec_connector_routing.py -v— 69 passed (subset of these files)..venv/bin/pre-commit runon the changed files — passed.cargo test -p vllm-server merge_kv/merge_ec— 3 passed.AI assistance
This PR was developed with AI assistance.
Made with Cursor