fix: sanitize pydantic v2 input_value in validation errors#71
fix: sanitize pydantic v2 input_value in validation errors#71Evrard-Nil merged 3 commits intomainfrom
Conversation
vLLM returns validation errors in pydantic v2 format which uses
input_value={...} instead of 'input': ... — this bypassed the
existing sanitizer, potentially leaking user message content in
error responses.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a potential data leakage vulnerability where vLLM's Pydantic v2 validation errors could expose sensitive user data, such as message content, in error responses. The changes extend the existing error sanitization mechanism to specifically detect and strip Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request enhances the sanitize_validation_errors function to correctly handle and sanitize Pydantic v2 error messages, preventing the leakage of sensitive user data from input_value and input_type fields, and also filters out Pydantic v2 documentation URLs. The review identified a potential data leak in the Pydantic v2 sanitization logic if the error message format is unexpected, and suggested an improvement to refactor repeated string literal checks for better maintainability.
- Fallback to "(validation error)" if desc contains input_value/input_type (handles edge case where sensitive data appears before brackets) - Add test for bracket-less input_value format - Run cargo fmt
Summary
input_value={...}, input_type=dict) which bypassed the existing sanitizer that only checked for Python dict format ('input':,'ctx':)input_value=/input_type=fields, stripping user data while preserving error description and typeTest plan
filecontent part request through cloud-api → inference-proxy → vLLM thatinput_valueis stripped from the error response🤖 Generated with Claude Code