Repository navigation
fix(deps): bump Pillow to 13.0.0 in the backend image - #4562
Merged
Merged
Conversation
…ity-enterprise#1124) The backend image pinned Pillow 11.1.0. OSV lists 90 advisories against that version, several of them Critical heap overflows in decoders that Image.open() reaches with default settings. Every 11.x and 12.x release is affected: 12.3.0 still carries 62 open advisories, including the bundled-OpenJPEG write overflow that has been present since 11.1.0. 13.0.0 is the first release that fixes all of them, and OSV lists none against it. The exposure matters because the backend now decodes avatar images taken from template repositories (local templates and GitHub templates), so the bytes handed to Pillow come from whoever wrote the template. 13.0.0 ships cp313 manylinux_2_28 wheels for both x86_64 and aarch64, which the trixie base image (glibc 2.41) installs. The only Pillow calls the backend makes are Image.open, .width/.height, thumbnail with Image.LANCZOS, and a WebP save; none of them is removed or changed in 12.0 or 13.0 (Image.LANCZOS is one of the constants Pillow restored for good in 9.4). The test requirements floor moves with it so CI never resolves an older Pillow than the image ships.
…install The tests for _install_bundled_avatar_bytes stub both Image.open and optimize_avatar, so a Pillow upgrade that broke the header read, the resize or the WebP encoder would leave them green. This test passes real PNG and WebP bytes (the two formats a template may bundle) through the function with nothing mocked on the image path, and checks that the file written is a 512x384 WebP with the source colour. Checked that it fails when the decoder cannot read the input: restricting optimize_avatar's Image.open to JPEG turns both cases red with UnidentifiedImageError.
AndriiPasternak31
marked this pull request as ready for review
November 13, 2026 20:33
obasilakis
approved these changes
Nov 13, 2026
obasilakis
left a comment
Contributor
There was a problem hiding this comment.
/review + /validate-pr — APPROVE
Lane C (docker/backend/Dockerfile). Scope clean: Pillow pin, test-requirements floor, one feature-flow line, one new test.
Verified
- Pillow 13.0.0 is on PyPI (uploaded 2026-10-16) with cp313 manylinux_2_28 wheels for x86_64 and aarch64.
- Every backend call site (
utils/image_optimize.py:Image.open,thumbnail(..., Image.LANCZOS), WebP save;services/agent_service/crud.py:Image.openheader read,.width/.height) runs on 13.0.0 with warnings set to errors: PNG, WebP and JPEG 1024x768 inputs each produce a 512x384 WebP. No deprecations raised. - The
#comment inside theRUN pip installcontinuation matches existing lines in the same block; Docker strips it.prod-image-smokeis green. tests/requirements-test.txtfloor>=13.0.0keeps CI from testing an older Pillow than the image ships.
Execution coverage
| changed item | executed by | live consumer | verdict |
|---|---|---|---|
Pillow==13.0.0 pin |
prod-image-smoke; new test_install_decodes_a_real_bundled_image_into_a_webp_avatar (pytest (head) green) |
utils/image_optimize.py::optimize_avatar, crud.py::_install_bundled_avatar_bytes |
✅ executed |
| new test | itself, real PNG/WebP bytes, nothing mocked on the image path | same | ✅ executed; the PR's mutation (JPEG-only Image.open) turns it red |
Informational
Part of abilityai/trinity-enterprise#1124carries no closing keyword. That is correct here, since the issue also covers python-jose, the pin manifest and Dependabot. The issue status will not auto-promote on merge.- Lane C merge gate:
journey-smokeis green on the PR,frontend-e2ewas skipped (nouilabel). The diff does not touch the frontend; add theuilabel if the merge needs that context to be strict. - Enterprise
member_agents/router.pyalso imports PIL and was not checked here. It runs in the same image, soprod-image-smokecovers import but not its call path.
Process / security
- Conventional commits (
fix(deps),test(avatar)); targetsdev; 4 files. - No secrets, emails, IPs, mode changes or host paths in the diff.
- Tier 1 green; no open
dev-ci redissue.
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.
Part of Abilityai/trinity-enterprise#1124 (the Pillow part only; the python-jose, pin-manifest and Dependabot parts stay open there)
Summary
The backend image pinned Pillow 11.1.0, which carries 90 published advisories (OSV), including Critical heap overflows in decoders that
Image.open()reaches with default settings. The backend now decodes avatar images supplied by template repositories, so those bytes are untrusted input.Every 11.x and 12.x release is still affected (12.3.0 has 62 open advisories, among them the bundled-OpenJPEG write overflow present since 11.1.0). 13.0.0 is the first release that fixes all of them; OSV and the GitHub advisory database list none against it.
Changes
docker/backend/Dockerfile:Pillow==11.1.0→Pillow==13.0.0.tests/requirements-test.txt: floor raised to>=13.0.0so CI never runs an older Pillow than the image ships.docs/memory/feature-flows/agent-avatars.md: dependency version updated.tests/unit/test_1173_hub_display_avatar.py: real PNG and WebP bytes go through_install_bundled_avatar_byteswith nothing mocked on the image path. The existing tests stubImage.openandoptimize_avatar, so they could not catch a Pillow upgrade that broke decoding.Compatibility
13.0.0 ships cp313 manylinux_2_28 wheels for x86_64 and aarch64. The backend uses
Image.open,.width/.height,thumbnail(..., Image.LANCZOS)and WebP save; none of these is removed or changed in 12.0 or 13.0.Verification
Validation: the backend image builds (arm64);
pip show pillowin it reports 13.0.0. Inside the image a PNG and a WebP each go through_install_bundled_avatar_bytesto a 512x384 WebP, and the three bundled template avatars go throughoptimize_avatarto 512x512 WebP. Avatar and Dockerfile/requirements parity unit tests on Python 3.13: 1065 passed, 29 skipped.Mutation: restricting
optimize_avatar'sImage.opento JPEG turns the new test red (UnidentifiedImageError, 2 failed).Unverified:
jpg_20002.5.4.Journey Impact
Journey Impact: none: dependency bump; avatars decode exactly as before