Skip to content

Handle webp_transform input robustly#13390

Open
bneradt wants to merge 1 commit into
apache:masterfrom
bneradt:webp-transform-invalid-input
Open

Handle webp_transform input robustly#13390
bneradt wants to merge 1 commit into
apache:masterfrom
bneradt:webp-transform-invalid-input

Conversation

@bneradt

@bneradt bneradt commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

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 bneradt added this to the 11.0.0 milestone Jul 15, 2026
Copilot AI review requested due to automatic review settings July 15, 2026 19:40
@bneradt bneradt self-assigned this Jul 15, 2026
@bneradt
bneradt force-pushed the webp-transform-invalid-input branch from 4966723 to c917a72 Compare July 15, 2026 19:42
@bneradt bneradt changed the title Guard webp_transform image input Handle webp_transform input robustly Jul 15, 2026
@bneradt
bneradt requested a review from shukitchan July 15, 2026 19:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 invalid webp/jpeg/png bodies 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.

Comment thread plugins/webp_transform/ImageTransform.cc
Copilot AI review requested due to automatic review settings July 15, 2026 19:45
@bneradt bneradt removed the AuTest label Jul 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

Comment thread plugins/webp_transform/ImageTransform.cc
Copilot AI review requested due to automatic review settings July 15, 2026 20:04
@bneradt
bneradt force-pushed the webp-transform-invalid-input branch from c917a72 to 6aeddc6 Compare July 15, 2026 20:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment thread plugins/webp_transform/ImageTransform.cc
Comment thread plugins/webp_transform/ImageTransform.cc Outdated
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.
Copilot AI review requested due to automatic review settings July 15, 2026 21:19
@bneradt
bneradt force-pushed the webp-transform-invalid-input branch from 6aeddc6 to 65c7b89 Compare July 15, 2026 21:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@shukitchan shukitchan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks ok, trying to return the untouched image on errors/failed checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status
Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants