mirror of
https://github.com/mikecarper/MeshCore.git
synced 2026-09-22 03:04:22 +00:00
Retry identity startup and harden replay state and permissions
Read identities up to three times before allowing replacement, publish only complete reads, and require new startup keys to be saved with bounded retries. Use authoritative replay-file metadata throughout persistence and clock recovery. Validate setperm input before narrowing or mutating roles, and add production-path regression coverage.
This commit is contained in:
@@ -116,14 +116,14 @@ void setup() {
|
||||
if (needs_identity) {
|
||||
MESH_DEBUG_PRINTLN("Generating new keypair");
|
||||
identity_ready = mesh::generateUsableLocalIdentity(the_mesh.self_id, radio_new_identity);
|
||||
if (identity_ready) store.save("_main", the_mesh.self_id);
|
||||
if (identity_ready) identity_ready = store.saveWithRetry("_main", the_mesh.self_id);
|
||||
}
|
||||
|
||||
#if defined(ESP32_PLATFORM)
|
||||
mesh::discardESP32TrueRandom();
|
||||
#endif
|
||||
if (!identity_ready) {
|
||||
MESH_DEBUG_PRINTLN("Identity generation exhausted all attempts; rebooting");
|
||||
MESH_DEBUG_PRINTLN("Identity generation or persistence failed after retries; rebooting");
|
||||
board.reboot();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user