fix: sanitize imgproxy source image errors#1138
Merged
Merged
Conversation
requires enabling dev errors Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts the image-rendering error handling around imgproxy to avoid leaking source-image details (e.g., signed URLs) and to map certain known source-image failures to clearer, client-facing 4xx responses.
Changes:
- Introduces message/pattern-based mapping for known imgproxy “source image” failures, returning sanitized messages and (for validation failures) 400s.
- Updates unit tests to cover the new error mapping/sanitization behavior.
- Adds an acceptance test for a specific imgproxy source-image validation failure case, and updates local infra to pin imgproxy and enable development error messages.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/storage/renderer/image.ts | Adds imgproxy error sanitization/mapping helper logic used by handleRequestError. |
| src/storage/renderer/image.test.ts | Expands unit test coverage for sanitized/mapped imgproxy error outputs. |
| acceptance/specs/cdn-render.test.ts | Adds acceptance coverage ensuring a known source-image validation failure returns a 400 with a stable message. |
| .docker/docker-compose-infra.yml | Pins imgproxy version and enables development errors mode for reproducible error-message matching. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Coverage Report for CI Build 27127194068Coverage increased (+0.03%) to 76.441%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions3 previously-covered lines in 1 file lost coverage.
Coverage Stats💛 - Coveralls |
fenos
approved these changes
Jun 8, 2026
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.
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
Source image related errors are returning 500s due to genuine problems in the source such as non-image content, broken format, etc.
What is the new behavior?
Sanitize known errors to well-known messages and return as 400s.
Additional context
It requires enabling dev errors to match error messages. If it's not enabled, no match and current behavior doesn't change.