Handle webp_transform input robustly#13390
Open
bneradt wants to merge 1 commit into
Open
Conversation
bneradt
force-pushed
the
webp-transform-invalid-input
branch
from
July 15, 2026 19:42
4966723 to
c917a72
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the webp_transform plugin against empty or mislabeled image payloads by validating image signatures before invoking ImageMagick, and adds replay-based coverage for invalid inputs.
Changes:
- Add a lightweight signature check (
has_signature_for) to reject invalidwebp/jpeg/pngbodies before calling ImageMagick, passing invalid bodies through unchanged. - Add a new AuTest replay and wrapper test to exercise empty payloads, invalid payloads, and a valid WebP→JPEG conversion.
- Add log validation to confirm the plugin rejects invalid input and avoids known ImageMagick decode error paths.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| plugins/webp_transform/ImageTransform.cc | Adds signature validation and passthrough behavior to avoid invoking ImageMagick on invalid/mislabeled bodies. |
| tests/gold_tests/pluginTest/webp_transform/webp_transform_invalid_input.test.py | Adds a replay-driven gold test wrapper for invalid-input coverage. |
| tests/gold_tests/pluginTest/webp_transform/webp_transform_invalid_input.replay.yaml | Defines replay transactions and log validations for empty/invalid bodies plus a valid conversion case. |
bneradt
force-pushed
the
webp-transform-invalid-input
branch
from
July 15, 2026 20:04
c917a72 to
6aeddc6
Compare
Empty or mislabeled image responses need consistent handling by the webp_transform plugin. These inputs should pass through unchanged while valid images continue to be converted normally. This checks the expected image signature before conversion and preserves the original body and content type whenever conversion is bypassed. Replay coverage exercises empty, invalid, and valid image bodies.
bneradt
force-pushed
the
webp-transform-invalid-input
branch
from
July 15, 2026 21:19
6aeddc6 to
65c7b89
Compare
shukitchan
approved these changes
Jul 15, 2026
shukitchan
left a comment
Contributor
There was a problem hiding this comment.
This looks ok, trying to return the untouched image on errors/failed checks.
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.
Empty or mislabeled image responses need consistent handling by the
webp_transform plugin. These inputs should pass through unchanged while
valid images continue to be converted normally.
This checks the expected image signature before conversion and preserves
the original body and content type whenever conversion is bypassed.
Replay coverage exercises empty, invalid, and valid image bodies.