fix(reporter,docs): save config before applying; correct README trust-model
Reorder reporter_heartbeat so NVS persistence commits before in-RAM apply. If save fails, log and return without touching runtime state; RAM and NVS stay consistent on the prior version instead of diverging until reboot. Rewrite README "Trust model" to state reality: reporting is plain HTTP and HMAC signs only requests, not responses. A LAN-local MITM can push any config that passes the device range validator. Add roadmap entry for authenticated config push (HTTPS or signed envelope).
This commit is contained in:
@@ -236,12 +236,12 @@ void reporter_heartbeat(const DeviceConfig& cfg, uint32_t uptime_s, int wifi_rss
|
||||
return;
|
||||
}
|
||||
|
||||
cv_apply_tuning(candidate);
|
||||
if (!config_save_tuning(candidate)) {
|
||||
Serial.printf("[CFG] applied v=%u but NVS save failed\n", (unsigned)new_ver);
|
||||
} else {
|
||||
Serial.printf("[CFG] applied v=%u\n", (unsigned)new_ver);
|
||||
Serial.printf("[CFG] rejected v=%u: NVS save failed\n", (unsigned)new_ver);
|
||||
return;
|
||||
}
|
||||
cv_apply_tuning(candidate);
|
||||
Serial.printf("[CFG] applied v=%u\n", (unsigned)new_ver);
|
||||
}
|
||||
|
||||
void reporter_flush(const DeviceConfig& cfg) {
|
||||
|
||||
Reference in New Issue
Block a user