Repository navigation
[Security] Restrict Pillow image formats on untrusted media paths - #60022
DarkLight1337 merged 2 commits into
Conversation
Open untrusted multimodal image bytes only with an audited Pillow format allowlist so PostScript/EPS payloads cannot reach external renderers. Cover ImageMediaIO and the Kimi fused-vision path, and add regression tests for rejected and accepted formats. Co-authored-by: Cursor Agent Signed-off-by: Juan Pérez de Algaba <jperezde@redhat.com>
|
@DarkLight1337 This MR is the public version of the one you just reviewed privately |
DarkLight1337
left a comment
There was a problem hiding this comment.
Yeah, just double checking using AI. LGTM
|
/ci run --allow-stale |
|
✅ Triggered Buildkite CI #92844 for commit |
CI selector (shadow): 20 test steps (46 jobs) instead of 57 (73 jobs)Shadow mode: this changes nothing about what CI runs. It shows what the evidence-based selector would pick for this PR, next to today's rules. How it works. Feedback welcome: reply here if it would skip a step this change needs, or runs something unrelated.
Selector would run (20)
Would skip (today's rules run them) (43)
Would add (today's rules do not run them) (6)
AMD mirrors: would skip (39)
AMD mirrors: would add (3)
4 changed files · base |
|
/ci retry |
…lm-project#60022) Signed-off-by: Juan Pérez de Algaba <jperezde@redhat.com>

Summary
Untrusted image bytes were passed to Pillow without a format allowlist, so PostScript/EPS payloads could be dispatched to an external renderer during multimodal media loading. This change opens images only with an explicit raster-format allowlist on the shared media loader and the Kimi fused-vision path that also opens raw bytes.
Changes
vllm/multimodal/image.py: addALLOWED_IMAGE_FORMATS(PillowImage.OPENaudit: allow native in-process readers; denyEPS,WMF, stub drivers,MPEG) andopen_image().vllm/multimodal/media/image.py: useopen_image()inImageMediaIO.load_bytes().vllm/transformers_utils/processors/kimi_k25_vision_fused.py: useopen_image()in_to_pil()(module-scope import).tests/multimodal/media/test_image.py: reject PostScript payloads; keep common raster formats accepted; assert denied plugins stay off the allowlist; assertopen_imagehas noformatsoverride.Codepath coverage
MediaConnector→ImageMediaIO.load_bytes/load_base64/load_file: covered.ImageMediaIOmethods: covered.video/jpegframe decoding that reusesImageMediaIO: covered._to_pilraw bytes / data-URL / path opens: covered.Duplicate-work check
Searched open and merged PRs for
ImageMediaIO,open_image,ALLOWED_IMAGE_FORMATS, and Pillowformats=allowlist wording. No open or merged PR adds a Pillowformats=allowlist on untrusted image opens.Tests
test_image_media_io_rejects_postscript_payloadtest_image_media_io_accepts_common_raster_formatstest_allowed_image_formats_exclude_external_renderer_pluginstest_kimi_fused_vision_rejects_postscript_payloadtest_open_image_does_not_accept_format_overrideCommands:
All passed.
pre-commit run --fileson the touched paths passed.AI assistance
This PR was developed with AI assistance.
Made with Cursor