fix(tools): trust-tool review minors (no silent re-key, unique staging, stricter fences) #19
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/trust-tool-review-minors"
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(tools): trust-tool review minors (no silent re-key, unique staging, stricter fences)
The
communicator-esp32half of the deferred review minors recorded in thefleet TLS-only handover (
HANDOVER.md§3.5). All of these were triaged "ship,not blocking" during pieces 1 and 2; this addresses the six that live in the
fleet trust authority and its fences.
What changes
A complete set is never silently re-keyed (the most serious of the set).
ensuretreated a set whoseMANIFESTcould not be parsed as "no set" andregenerated it. Regenerating changes the CA a flashed device has pinned, so a
corrupt MANIFEST would have quietly bricked the fleet's trust relationship. It
now returns
unreadable— exit 2, printing the--regenerateremedy — and onlyan explicit
--regeneratere-keys.header --allow-devhas the same hole fixeddifferently: it no longer consults the MANIFEST at all, because rendering a
header needs presence and the leaf is what decides whether a SAN is covered.
ensure's refusals print a remedy naming--regenerate, asheader'salready did. Previously a refusal was a bare
TRUST: refusedwith no next step.Concurrent
ensureruns cannot collide. Staging used fixed siblings(
.dev-trust.tmp,.dev-trust.old), so two builds sharing a trust directorywould delete each other's half-written material. Staging names now carry the pid
and a random suffix.
SAN parsing is anchored and shared.
_SAN_LABELwas unanchored, so a labeloccurring inside a value was eaten (a URI SAN
https://host/DNS:xlost/DNS:x). Parsing is now a puresan_values()— unit-testable without openssl —and
missing_sans()replaces thetry/exceptthat_cmd_headerhad duplicatedfrom
covers().Two fences are harder to fool. The placeholder's prose no longer spells out
the markers it lacks, so a checker that greps for a marker without its
#defineprefix cannot be satisfied by the file's own comment. And the invariantfence now verifies that a header claiming presence really carries a PEM CA and a
32-byte public key, instead of inferring "placeholder" from the bare string
#error.Verification
Not in this PR
Four items from the same §3.5 list remain, deliberately:
OTA_TRUST_IS_DEV— this needs amain/C change and a realidf.pybuild to verify;genuine rework, not a fix;
embedded material against
tools/ota-keys/needs shell-level verification thehost suite cannot give;
message(STATUS):main/CMakeLists.txtdocuments thatidf.py does not surface
WARNINGfrom a component's CMakeLists, so "make it awarning" would make it invisible. No change is the correct answer here.