fix: more sanitization for imgproxy bad requests#1142
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the ImageRenderer’s handling of imgproxy failures to ensure all upstream error messages returned to callers are sanitized (including previously unsanitized/unmatched 4xx responses), aligning with the goal described in #1138 and this PR’s description.
Changes:
- Added a set of “public” imgproxy error patterns and mapped them to controlled, non-leaking messages (with appropriate internal
httpStatusCodevalues). - Changed the fallback behavior for unmatched imgproxy errors to return a controlled message (
Invalid image request) instead of passing through the upstream body. - Expanded/updated the test suite to cover new sanitization cases (including trimming whitespace and additional imgproxy error strings).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/storage/renderer/image.ts |
Adds broader imgproxy error pattern mapping and ensures sanitized, controlled error messages for all non-OK responses. |
src/storage/renderer/image.test.ts |
Updates and extends tests to validate the new mapping/sanitization behavior across more upstream status/body combinations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Coverage Report for CI Build 27200273215Coverage increased (+0.03%) to 76.458%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions2 previously-covered lines in 1 file lost coverage.
Coverage Stats💛 - Coveralls |
fenos
approved these changes
Jun 9, 2026
Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
07fb246 to
d712561
Compare
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?
Some imgproxy errors are matched and enriched. 5XX are always sanitized but unmatched 4XX is passed to client.
What is the new behavior?
All error messages are sanitized.
Additional context
Related to #1138