Skip to content

P1: GitHub CA Chain — Fix TLS certificate validation for OTA downloads #79

Description

@stritti

Background

OtaUpdater::downloadAndApply() pins the ISRG Root X1 (Let's Encrypt) certificate, but GitHub release download URLs are served via GitHub's CDN which may use Sectigo or other CA chains. When the pinned root CA does not match, TLS fails and every OTA update is blocked.

Additionally, fetchLatestRelease() uses setInsecure() (no cert validation), defeating TLS entirely for the metadata fetch.

Required Changes

  1. Use CA bundle: Replace setCACert(kGitHubRootCA) with WiFiClientSecure::setCACertBundle() on ESP32
  2. Fix metadata TLS: Replace setInsecure() in fetchLatestRelease() with the same CA trust store
  3. Fallback for ESP8266: Provide curated fallback CA bundle for flash-constrained devices

Affected Files

  • src/OtaUpdater.cpp — Both downloadAndApply() and fetchLatestRelease()
  • src/OtaUpdater.hpp — Compile-time flag OTA_USE_CA_BUNDLE
  • platformio.ini — Add -DCORE_SSL_CERT_BUNDLE build flag
  • src/CACertBundle.hpp — New: fallback bundle

OpenSpec

Full specification: openspec/specs/github-ca-chain.spec.md
Change marker: openspec/changes/p1-github-ca-chain/

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Priority 1 — must fix before next releaseenhancementNew feature or requestsecuritySecurity-related issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions