firmware
firmware copied to clipboard
fix(HeavyButter): add SHA-256 integrity verification for App Store downloads
Summary
Adds SHA-256 integrity checking to App Store downloads to prevent tampered scripts from being installed.
Changes
- Add
verify_sha256()helper using mbedtls SHA-256 - Add
EXPECTED_APPSTORE_SHA256build-time macro (empty = check skipped) - Download content is fetched first, hash verified, then only saved if integrity check passes
- If hash mismatch, user sees warning and file is not written
Security Impact
Before: Anyone who can MITM the HTTP connection (or compromise the server) can inject arbitrary JS that runs with full device permissions.
After: The App Store script hash is pinned in firmware. Mismatched content is rejected. The maintainer sets the expected hash once the server content is verified.