Skip to content

feat(polyshell-patch): harden ImageProcessor validation with GD re-encode and caps#13

Open
speedupmate wants to merge 1 commit intomarkshust:mainfrom
speedupmate:strict-image-validation
Open

feat(polyshell-patch): harden ImageProcessor validation with GD re-encode and caps#13
speedupmate wants to merge 1 commit intomarkshust:mainfrom
speedupmate:strict-image-validation

Conversation

@speedupmate
Copy link
Copy Markdown

Add StrictImagePayloadValidator plus an around plugin on ImageProcessor::processImageContent to verify magic bytes, align parser MIME with the declared type, enforce a 5 MiB decoded ceiling and Base64 length bound, cap dimensions before GD work, and require ext-gd to re-encode JPEG/PNG/GIF so non-image data is dropped. Keep extension allowlists on the validator and uploader; throw LocalizedException with __() for user-facing errors. Composer now requires ext-gd; PHPCS-clean with targeted DiscouragedFunction ignores.

…e and caps

Add StrictImagePayloadValidator plus an around plugin on ImageProcessor::processImageContent
to verify magic bytes, align parser MIME with the declared type, enforce a 5 MiB decoded
ceiling and Base64 length bound, cap dimensions before GD work, and require ext-gd to
re-encode JPEG/PNG/GIF so non-image data is dropped. Keep extension allowlists on the
validator and uploader; throw LocalizedException with __() for user-facing errors.
Composer now requires ext-gd; PHPCS-clean with targeted DiscouragedFunction ignores.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant