fix(review): the last three esp32 TLS-only review minors #20
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/fleet-tls-review-minors-esp32"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
fix(review): the last three esp32 TLS-only review minors
The esp32 half of the deferred review minors in
HANDOVER.md§3.5 — the threethat esp32 PR #19 deliberately left behind, each for a stated reason. All three
are addressed here, and the reasons they were deferred are removed rather than
worked around.
A. Runtime provenance for dev trust material
OTA_TRUST_IS_DEVexisted in the header but was never referenced by thefirmware, so a flashed device gave no signal about which CA it pins — the one
thing a field diagnosis of a trust problem needs.
app_main()now logs it at boot:Verified with two real
idf.pybuilds, since the deferral reason was "needsa
main/C change and a realidf.pybuild":tools/ota-keys/present): configure generates productionmaterial,
main.c.objcompiles,communicator.binlinks.CONFIG_SERVER_HOSTcovered by the shareddev set): the
DEV TRUST MATERIALbanner fires, the header carries#define OTA_TRUST_IS_DEV 1,main.c.objcompiles theESP_LOGWbranch,and the image links.
Both builds left the tree restored: the tracked
main/ota_trust.his back to theplaceholder and the production keys are back in
tools/ota-keys/.C. The release refusal now compares material, not markers
release_firmware.shrefused dev material withgrep -q "#define OTA_TRUST_IS_DEV". A marker grep cannot tell two CAs apart: a stale headerleft from another CA would still pass and ship a fleet that trusts the wrong
root.
The check moves into the trust tool as a real, testable subcommand:
It checks presence (
OTA_TRUST_PRESENT), the absence of the dev marker, andthat the header's embedded CA — parsed out of the C string literal and
unescaped — equals
--ca.release_firmware.shcalls it againsttools/ota-keys/ca.pem.The deferral reason was "needs shell-level verification the host suite cannot
give". Moving the logic into Python removes that: the behaviour is now
unit-tested (
verify_header,embedded_ca_pem, and the CLI exit codes), and itwas also verified at the shell level — a generated production header passes
(exit 0), a header checked against a different CA exits 1.
B. The invariant fences are no longer greps-on-the-header
host/tests/test_tls_invariant.py's trust-header checks were string-shapegreps. They now compile the header with the C compiler (
cc -std=c11 -Wall -Werror) and run a probe against it:(the
#error), replacing the "either placeholder or real material" shapetest;
OTA_TRUST_PRESENTand notOTA_TRUST_IS_DEV, and reports a 32-byte key and a non-empty CA;#define OTA_TRUST_PRESENT 1with no material fails tocompile, because nothing declares the symbols the firmware uses — the exact
gap the old shape check could not close.
The remaining checks stay static, by necessity rather than by preference:
ws_client.candmain/CMakeLists.txtare ESP-IDF-only and cannot be compiledby the host suite. They are now documented as what they are — complements to
the
idf.pybuild gate, never replacements for it. One is added for thischange:
test_firmware_logs_dev_trust_provenancepins that the firmwarereferences
OTA_TRUST_IS_DEVand logs it.Review follow-up
Whole-branch review returned no Critical and no Important findings. The worthwhile
Minors were folded in as a follow-up commit: an argparse
--helpsentinelregression this branch introduced (adding the fourth subcommand left
--helpdumping the whole docstring),
embedded_ca_pemhardened against acommented-out initializer, CRLF normalisation in
verify_header, and a strongeritem-A test that requires the guarded
#if defined(OTA_TRUST_IS_DEV)form and bothlog lines rather than bare substrings.
Verification
py_compileon the changed Python,bash -non the changed shell clean./home/<user>, no internal IPs) clean.idf.py buildboth green; working tree restored.Not in this PR
The on-hardware dev-trust run (HANDOVER §3.3) remains deferred: it needs the
physical unit on
/dev/ttyACM0, a human to hear the reply, and a mandatoryre-flash back to production trust afterwards.