android build: forbid buildozer to install unversioned deps of p4a
What changed, and why it matters
This commit tightens the Android build process for the Electrum Bitcoin wallet. It stops an automated build tool (buildozer) from silently downloading unversioned Python helper packages, and instead installs the 'ninja' build tool from the more carefully reviewed Debian software repository. The change reduces the risk that a compromised or malicious helper package could sneak into the Android app build, but it is a hardening improvement rather than a fix for an active attack.
Treat as a routine hardening patch. Reviewers should verify the new buildozer commit hash and the added Debian/package hashes, then merge. No immediate incident response is warranted unless the project has evidence that prior unversioned installs were already exploited.
Security signals we found
Supply-chain hardening: prevents unversioned dependency installation during Android build
Pinning update: buildozer checkout commit changed to newer ref
Dependency source shift: ninja moved from PyPI to Debian apt package
Deterministic requirements refreshed with pinned hashes
Evidence from the diff
The patch updates the Android Dockerfile to install ninja-build via apt instead of allowing buildozer/python-for-android to fetch unversioned dependencies. It also pins a newer buildozer checkout (6242e3e41365e70f76bd18f30992dcc5898ad40e) and refreshes the deterministic requirements files: pep517 is replaced by build and pyproject-hooks, and sh is constrained to >=2,<3.0. These changes move dependency installation from runtime/pip-side resolution to pinned, auditable sources, improving supply-chain integrity of the Android build.
Changed components
Android build environment (contrib/android/Dockerfile)Deterministic Android build requirements (contrib/deterministic-build/requirements-build-android.txt)Loose Android build requirements (contrib/requirements/requirements-build-android.txt)Inspect captured patch +11 / −5
diff --git a/contrib/android/Dockerfile b/contrib/android/Dockerfile
index 5d5bda9..0067277 100644
--- a/contrib/android/Dockerfile
+++ b/contrib/android/Dockerfile
@@ -176,6 +176,7 @@ RUN apt -y update -qq \
&& apt -y install -qq --no-install-recommends --allow-downgrades \
libopengl-dev \
libegl-dev \
+ ninja-build \
&& apt -y autoremove \
&& apt -y clean
@@ -225,7 +226,7 @@ RUN /opt/venv/bin/python3 -m pip install --no-build-isolation --no-dependencies
-r /opt/deterministic-build/requirements-build-android.txt
# install buildozer
-ENV BUILDOZER_CHECKOUT_COMMIT="4403ecf445f10b5fbf7c74f4621bf2b922ad35b5"
+ENV BUILDOZER_CHECKOUT_COMMIT="6242e3e41365e70f76bd18f30992dcc5898ad40e"
# ^ from branch electrum_20240930 (note: careful with force-pushing! see #8162)
RUN cd /opt \
&& git clone https://github.com/spesmilo/buildozer \
diff --git a/contrib/deterministic-build/requirements-build-android.txt b/contrib/deterministic-build/requirements-build-android.txt
index 00f79a7..b46494b 100644
--- a/contrib/deterministic-build/requirements-build-android.txt
+++ b/contrib/deterministic-build/requirements-build-android.txt
@@ -1,5 +1,7 @@
appdirs==1.4.4 \
--hash=sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41
+build==1.4.0 \
+ --hash=sha256:f1b91b925aa322be454f8330c6fb48b465da993d1e7e7e6fa35027ec49f3c936
colorama==0.4.5 \
--hash=sha256:e6c6b4334fc50988a639d9b98aa429a0b57da6e17b9a44f0451f930b6967b7a4
Cython==0.29.37 \
@@ -10,14 +12,14 @@ MarkupSafe==3.0.3 \
--hash=sha256:722695808f4b6457b320fdc131280796bdceb04ab50fe1795cd540799ebe1698
packaging==26.2 \
--hash=sha256:ff452ff5a3e828ce110190feff1178bb1f2ea2281fa2075aadb987c2fb221661
-pep517==0.13.1 \
- --hash=sha256:1b2fa2ffd3938bb4beffe5d6146cbcb2bda996a5a4da9f31abffd8b24e07b317
pexpect==4.9.0 \
--hash=sha256:ee7d41123f3c9911050ea2c2dac107568dc43b2d3b0c7557a33212c398ead30f
pip==25.1.1 \
--hash=sha256:3de45d411d308d5054c2168185d8da7f9a2cd753dbac8acbfa88a8909ecd9077
ptyprocess==0.7.0 \
--hash=sha256:5c5d0a3b48ceee0b48485e0c26037c0acd7d29765ca3fbb5cb3831d347423220
+pyproject-hooks==1.2.0 \
+ --hash=sha256:1e859bd5c40fae9448642dd871adf459e5e2084186e8d2c2a79a824c970da1f8
setuptools==80.9.0 \
--hash=sha256:f36b47402ecde768dbfafc46e8e4207b4360c654f1f3bb84475f0a28628fb19c
sh==2.2.2 \
diff --git a/contrib/requirements/requirements-build-android.txt b/contrib/requirements/requirements-build-android.txt
index e9d2728..8f5c5b0 100644
--- a/contrib/requirements/requirements-build-android.txt
+++ b/contrib/requirements/requirements-build-android.txt
@@ -9,13 +9,16 @@ sh
cython<3.0
# needed by python-for-android:
+# ref https://github.com/spesmilo/python-for-android/blob/1098be6964cfc2156959e435e81c2c50f8398586/setup.py#L22
+# (meson and ninja we skip as not needed)
appdirs
# colorama upper bound to avoid needing hatchling
colorama>=0.3.3,<0.4.6
jinja2
-sh>=1.10
-pep517
+sh>=2,<3.0
toml
+build
+packaging
# needed for the Qt/QML Android GUI:
# TODO double-check this
Why this scored 20/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.