Skip to content

fix(controller): verify download integrity + fail closed on TLS (D6)#12

Merged
luisguzman-adfa merged 1 commit into
mainfrom
fix/phase1-security-d6-download-integrity
Jun 18, 2026
Merged

fix(controller): verify download integrity + fail closed on TLS (D6)#12
luisguzman-adfa merged 1 commit into
mainfrom
fix/phase1-security-d6-download-integrity

Conversation

@luisguzman-adfa

Copy link
Copy Markdown
Collaborator

The rootfs is downloaded (latest_*.meta4 -> .tar.gz) and then extracted and executed as root, but Aria2Manager performed no integrity check and silently downgraded to --check-certificate=false when cacert.pem was missing. A compromised mirror or MITM could deliver a malicious rootfs (tech-debt D6).

  • TLS fail-closed: require cacert.pem (abort with a clear error if it cannot be provisioned) and always pass --check-certificate=true. The insecure fallback is removed. Applies to all aria2 downloads (rootfs + ZIM).
  • Integrity: add --check-integrity=true so aria2 verifies the SHA-256 checksums published in the .meta4 (file-level + per-piece) during the download. On mismatch aria2 exits non-zero, onError fires and the archive is never extracted/executed. This uses the server's published hash over a verified TLS channel, so no redundant on-device re-hash of the ~1.2 GB file is needed.

Out of scope (separate items): ZIM content integrity (Kiwix publishes no embedded hash today) and the cleartext OTA APK path in MainActivity (F15).

The rootfs is downloaded (latest_*.meta4 -> .tar.gz) and then extracted and
executed as root, but Aria2Manager performed no integrity check and silently
downgraded to --check-certificate=false when cacert.pem was missing. A
compromised mirror or MITM could deliver a malicious rootfs (tech-debt D6).

- TLS fail-closed: require cacert.pem (abort with a clear error if it cannot be
  provisioned) and always pass --check-certificate=true. The insecure fallback
  is removed. Applies to all aria2 downloads (rootfs + ZIM).
- Integrity: add --check-integrity=true so aria2 verifies the SHA-256 checksums
  published in the .meta4 (file-level + per-piece) during the download. On
  mismatch aria2 exits non-zero, onError fires and the archive is never
  extracted/executed. This uses the server's published hash over a verified TLS
  channel, so no redundant on-device re-hash of the ~1.2 GB file is needed.

Out of scope (separate items): ZIM content integrity (Kiwix publishes no
embedded hash today) and the cleartext OTA APK path in MainActivity (F15).
@luisguzman-adfa luisguzman-adfa merged commit 9cb9fcc into main Jun 18, 2026
2 checks passed
@luisguzman-adfa luisguzman-adfa deleted the fix/phase1-security-d6-download-integrity branch June 18, 2026 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant