[Security] Apply sanitize_message to Anthropic and STT error paths#45119
Merged
DarkLight1337 merged 5 commits intoJun 11, 2026
Merged
Conversation
The fix for CVE-2026-22778 (PRs vllm-project#31987, vllm-project#32319) applied sanitize_message only to the OpenAI router exception handlers. The Anthropic API router, its SSE streaming converter, and the speech-to-text WebSocket paths return str(exc) directly without sanitization, leaking PIL object repr memory addresses to clients (ASLR-bypass primitive). Apply sanitize_message at all five affected sites: - anthropic/api_router.py POST /v1/messages exception handler - anthropic/api_router.py POST /v1/messages/count_tokens handler - anthropic/serving.py SSE streaming error event - speech_to_text/realtime/connection.py event loop error - speech_to_text/realtime/connection.py generation loop error Signed-off-by: Juan Pérez de Algaba <jperezde@redhat.com> Signed-off-by: jperezde <jperezde@redhat.com>
3033c52 to
9b959b6
Compare
Use importlib.util.find_spec to locate module source files instead of relative paths. The previous approach assumed the working directory was the repo root, which is not the case in CI environments. Signed-off-by: Juan Pérez de Algaba <jperezde@redhat.com> Signed-off-by: jperezde <jperezde@redhat.com>
auto-merge was automatically disabled
June 11, 2026 08:16
Head branch was pushed to by a user without write access
ryttry
pushed a commit
to ryttry/vllm
that referenced
this pull request
Jun 11, 2026
…llm-project#45119) Signed-off-by: jperezde <jperezde@redhat.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Saddss
pushed a commit
to Saddss/vllm
that referenced
this pull request
Jun 14, 2026
…llm-project#45119) Signed-off-by: jperezde <jperezde@redhat.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
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
sanitize_message()to all 5 error response sites in the Anthropic API router, its SSE streaming converter, and the speech-to-text WebSocket paths that were missed by the original CVE-2026-22778 fix (PRs [Frontend] Improve error message #31987, [Frontend] Standardize use ofcreate_error_response#32319).str(e)directly, bypassing the global FastAPI exception handler that already applies sanitization. PILUnidentifiedImageErrormessages containingBytesIOobject reprs leak heap addresses to attackers.Affected sites
vllm/entrypoints/anthropic/api_router.py/v1/messagesexception handlervllm/entrypoints/anthropic/api_router.py/v1/messages/count_tokenshandlervllm/entrypoints/anthropic/serving.pyvllm/entrypoints/speech_to_text/realtime/connection.pyvllm/entrypoints/speech_to_text/realtime/connection.pyTest plan
tests/entrypoints/anthropic/test_error_sanitization.pywith 9 tests covering sanitization of realistic PIL address patterns and source-level verification that all affected modules usesanitize_message.pytest tests/entrypoints/anthropic/test_error_sanitization.py -v— all 9 tests pass.pre-commit run --files <all changed files>— all hooks pass.