Background
OtaUpdater::fetchLatestRelease() uses setInsecure() to fetch GitHub API release metadata. A MITM can inject a fake release with a higher version tag and point downloadUrl_ to a malicious binary. This defeats the CA verification on the download side, since the attacker controls which URL is downloaded.
Required Changes
- TLS for metadata: Replace
setInsecure() in fetchLatestRelease() with CA bundle verification
- URL validation: Whitelist allowed download hosts (
*.github.com, objects.githubusercontent.com)
- Semver validation: Reject non-semver tag names (
tag_name must match v?MAJOR.MINOR.PATCH)
- Fresh fetch guard: Ensure fresh metadata fetch before update (no stale cache)
Affected Files
src/OtaUpdater.cpp — fetchLatestRelease(), startUpdate()
src/OtaUpdater.hpp — Validation helpers and constants
OpenSpec
Full specification: openspec/specs/release-metadata-tls.spec.md
Change marker: openspec/changes/p1-release-metadata-tls/
Related
Background
OtaUpdater::fetchLatestRelease()usessetInsecure()to fetch GitHub API release metadata. A MITM can inject a fake release with a higher version tag and pointdownloadUrl_to a malicious binary. This defeats the CA verification on the download side, since the attacker controls which URL is downloaded.Required Changes
setInsecure()infetchLatestRelease()with CA bundle verification*.github.com,objects.githubusercontent.com)tag_namemust matchv?MAJOR.MINOR.PATCH)Affected Files
src/OtaUpdater.cpp—fetchLatestRelease(),startUpdate()src/OtaUpdater.hpp— Validation helpers and constantsOpenSpec
Full specification:
openspec/specs/release-metadata-tls.spec.mdChange marker:
openspec/changes/p1-release-metadata-tls/Related