Merge pull request #729 from Foundation-Devices/sft-8489-dependabot-pillow-gif-seek-keeps-rejected-size-after
What changed, and why it matters
This commit updates the Passport firmware project's host-side tooling and simulator to use Pillow 13.0.0 instead of Pillow 12.3.x. The change is explicitly described as fixing open Pillow security advisories that are resolved in 13.0.0. It also fixes a small simulator bug where screen buffer reads could request more data than needed. The changes affect only developer/host tooling and the simulator, not the actual Passport hardware firmware.
Verify that all host development environments and CI have migrated to Pillow 13.0.0 or newer. Review whether the device firmware itself uses Pillow in any build path; if so, ensure it is also updated. The simulator buffer-read fix is minor but should be regression-tested. Consider monitoring Pillow security advisories for future updates.
Security signals we found
Dependency version bump explicitly motivated by open Pillow security advisories
Pillow 12.3.0 known to have public CVEs fixed in 13.0.0
Simulator buffer read loop corrected to avoid requesting more bytes than remaining buffer space
Changes scoped to host tooling/simulator, not device firmware
Evidence from the diff
The commit bumps Pillow from 12.3.x to 13.0.0 across multiple host-side dependency files (DEVELOPMENT.md, pyproject.toml, requirements-optional.txt, setup.py, simulator/requirements.txt, flake.nix). A flake.nix override is added because upstream nixpkgs still ships Pillow 12.3.0. The commit message and code comments explicitly state this addresses open Pillow advisories fixed in 13.0.0. Additionally, simulator/simulator.py is patched to read only the remaining bytes needed (DISP_BUF_SIZE - len(screen_buf)) rather than always requesting the full buffer size, preventing potential over-read behavior in the simulator’s screen buffer loop.
Changed components
extmod/trezor-firmware/pyproject.tomlextmod/trezor-firmware/python/requirements-optional.txtextmod/trezor-firmware/python/setup.pysimulator/requirements.txtsimulator/simulator.pyflake.nixDEVELOPMENT.mdInspect captured patch +35 / −9
### DEVELOPMENT.md
@@ -102,9 +102,9 @@ Passport comes with a set of `Justfile` command scripts. Using these commands r
cargo install just
-The image tooling requires Python 3.10 or newer and `Pillow` 12.3.x:
+The image tooling requires Python 3.11 or newer and `Pillow` 13.x:
- pip install 'Pillow>=12.3.0,<13'
+ pip install 'Pillow>=13.0.0,<14'
`ports/stm32/Justfile` contains all the `just` commands you can run to build firmware for Passport. You'll typically want to be in the `ports/stm32` folder to run these commands.
### extmod/trezor-firmware/pyproject.toml
@@ -55,7 +55,7 @@ click = "^7"
ed25519 = "^1.4"
requests = "^2.19"
termcolor = "*"
-Pillow = { version = "^12.3.0", python = ">=3.10" }
+Pillow = { version = "^13.0.0", python = ">=3.11" }
# crypto
ecdsa = "^0.16"
### extmod/trezor-firmware/python/requirements-optional.txt
@@ -1,6 +1,6 @@
hidapi >= 0.7.99.post20
rlp >= 1.1.0
web3 >= 4.8
-Pillow>=12.3.0,<13; python_version>='3.10'
+Pillow>=13.0.0,<14; python_version>='3.11'
stellar-sdk>=4.0.0,<6.0.0
types-click
### extmod/trezor-firmware/python/setup.py
@@ -37,7 +37,7 @@
"hidapi": ["hidapi>=0.7.99.post20"],
"ethereum": ["rlp>=1.1.0", "web3>=4.8"],
"qt-widgets": ["PyQt5"],
- "extra": ["Pillow>=12.3.0,<13; python_version>='3.10'"],
+ "extra": ["Pillow>=13.0.0,<14; python_version>='3.11'"],
"stellar": ["stellar-sdk>=4.0.0,<6.0.0"],
}
### flake.nix
@@ -66,15 +66,41 @@
config.allowUnfree = true;
};
customPackages = self.packages.${system};
- embit = pkgs.python3Packages.buildPythonPackage rec {
+ # nixpkgs still ships Pillow 12.3.0, which is affected by open Pillow
+ # advisories fixed in 13.0.0. Override it for the whole Python package
+ # set, so packages that depend on Pillow (imageio) use the same copy as
+ # the shell. Remove once nixpkgs carries Pillow >= 13.0.0.
+ python3 = pkgs.python3.override {
+ self = python3;
+ packageOverrides = pyFinal: pyPrev: {
+ pillow = pyPrev.pillow.overridePythonAttrs (old: rec {
+ version = "13.0.0";
+ src = pkgs.fetchPypi {
+ pname = "pillow";
+ inherit version;
+ hash = "sha256-zc0bolgXj3NW10FwyagbpOq2pdVXSLxAKloqb+a+NRA=";
+ };
+ # The shell needs the library, not its test suite, and nixpkgs'
+ # list of disabled tests is tuned for 12.3.0.
+ doCheck = false;
+ });
+ # imageio needs only numpy and Pillow at runtime. Its tests pull in
+ # every optional codec (pillow-heif, astropy, av, ...), which would
+ # all rebuild against the overridden Pillow, and one pillow-heif
+ # pixel comparison is off by one against 13.0.0.
+ imageio = pyPrev.imageio.overridePythonAttrs { doCheck = false; };
+ };
+ };
+ python3Packages = python3.pkgs;
+ embit = python3Packages.buildPythonPackage rec {
pname = "embit";
version = "0.8.0";
pyproject = true;
src = pkgs.fetchPypi {
inherit pname version;
hash = "sha256-i/SxAHPGdAA3DOUj+xbwNf51n2/dmHxXm9zCaNde13A=";
};
- build-system = with pkgs.python3Packages; [ setuptools wheel ];
+ build-system = with python3Packages; [ setuptools wheel ];
pythonImportsCheck = [ "embit.descriptor.arguments" ];
};
runtimeLibPath = with pkgs; pkgs.lib.makeLibraryPath [
### simulator/requirements.txt
@@ -11,6 +11,6 @@
# brew install sdl2
#
PySDL2
-Pillow
+Pillow>=13.0.0
opencv-python
imageio
### simulator/simulator.py
@@ -652,7 +652,7 @@ def send_event(ch, is_down):
# TODO: use shared memory (mmap or sh_mem, faster, doesn't need to "sync").
screen_buf = bytearray()
while len(screen_buf) < DISP_BUF_SIZE:
- buf = r.read(DISP_BUF_SIZE)
+ buf = r.read(DISP_BUF_SIZE - len(screen_buf))
if not buf:
# print('not read')
continueWhy this scored 34/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.