Skip to content
Back to skills

Esp32 Ota Server

ASecurity

Use when firmware updates are served to devices - an update downloads and does not boot, a bad release bricks a batch, devices update in a loop, or the rollback never happens. Covers versioning, staged rollout and the server side.

  • 16 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 7, 2026
ai-agentsrust

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned November 7, 2026

npx -y skills add Esmail-sarhadi/esp32-agent-skills --skill esp32-ota-server --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Esp32 Ota Server?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Esp32 Ota Server
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/esmail-sarhadi-esp32-ota-server/badge)](https://www.skillsdirectory.com/skills/esmail-sarhadi-esp32-ota-server)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: esp32-ota-server
description: Use when firmware updates are served to devices - an update downloads and does not boot, a bad release bricks a batch, devices update in a loop, or the rollback never happens. Covers versioning, staged rollout and the server side.
license: MIT
---

# The server side of OTA

The device code is the easy half. The hard half is deciding who gets which
binary, and what happens when that binary is wrong.

## Version comparison is a protocol

Compare versions as numbers, not strings: `1.10.0` is newer than `1.9.0` and
older than `1.10.1`, and a string comparison gets both wrong. Send a monotonic
build number as well - it is the only thing that survives a human typing the
version wrong.

The device should also report its hardware revision. A binary built for rev B on
a rev A board is a bricked unit that passed every check.

## Never serve a binary that has not booted

The pipeline, in order:

1. Build, run the host tests.
2. Flash one device on the bench, boot it, run a smoke test over the network.
3. Mark the release as "canary" and give it to 1 to 5 % of the fleet.
4. Watch the failure signal for 24 hours.
5. Promote, or pull.

The failure signal must be something the device reports, not something a human
notices: boot count, uptime after update, panic count, reconnect count.

## Rollback needs a trigger

`esp_ota_mark_app_valid_cancel_rollback()` is what makes an image permanent. If
the new firmware never calls it, the next reset rolls back - which is a safe
default and a confusing bug when you forget it. If it calls it immediately at
boot, rollback never happens even when the device is broken.

The pattern that works: mark valid only after the device has connected to the
network and served one successful request, with a timeout. A device that cannot
connect rolls back by itself.

## Update loops

| Symptom | Usually |
|---|---|
| updates, reboots, updates again | version reported is the old one - NVS not updated, or the app reads the file version |
| update succeeds, device offline | new firmware has wrong credentials or a new partition layout |
| half the fleet never updates | server returns 200 with an HTML error page; the device checks size, not content |
| update stalls at 90 % | chunked transfer with no `Content-Length`, or a proxy timeout |
| device bricks after power loss mid-update | single OTA slot; the running image was overwritten |

## Serving the file

- HTTPS with a certificate the device trusts (cert bundle, not pinned to one CA).
- `Content-Length` set, and a stable ETag so a resumed download is possible.
- Range requests if you want resumable updates over flaky links.
- The binary behind a signed URL, and the signature checked on the device if the
  fleet is worth attacking.

## What to log on the device

Report, per attempt: version before, version after, bytes, duration, result, and
the reason for failure. Without that, "some devices did not update" is a
diagnosis you cannot make.

Files in this skill

  • LICENSE.txt857 B
  • SKILL.md2.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.