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:
mikecarper committed 2026-09-15 17:33:50 -07:00
1 parent 24b1b1167f
commit b847b46ef7
21 files changed
+272 -73

No files matched your search

+3
View File
@@ -15,6 +15,7 @@ class IdentityStore {
FILESYSTEM* _fs;
const char* _dir;
public:
static constexpr unsigned IO_ATTEMPTS = 3;
IdentityStore(FILESYSTEM& fs, const char* dir): _fs(&fs), _dir(dir) { }
void begin() {
@@ -25,5 +26,7 @@ public:
bool load(const char *name, mesh::LocalIdentity& id);
bool load(const char *name, mesh::LocalIdentity& id, char display_name[], int max_name_sz);
bool save(const char *name, const mesh::LocalIdentity& id);
// Startup must not run with a new identity that was never made durable.
bool saveWithRetry(const char *name, const mesh::LocalIdentity& id);
bool save(const char *name, const mesh::LocalIdentity& id, const char display_name[]);
};