diff --git a/src/ConfigManager/ConfigManager.cpp b/src/ConfigManager/ConfigManager.cpp index b12ef84..ecc54b8 100644 --- a/src/ConfigManager/ConfigManager.cpp +++ b/src/ConfigManager/ConfigManager.cpp @@ -37,8 +37,10 @@ void ConfigManager::initializeCleanDefaults() { // Must match the MQTT_SECRET in the backend .env exactly. mqttConfig.password = computeMqttPassword(deviceConfig.serial); - LOG_INFO(TAG, "🔑 MQTT auth — user: %s, password: %s", mqttConfig.user.c_str(), mqttConfig.password.c_str()); - LOG_INFO(TAG, "🔑 MQTT_SECRET prefix: %.8s...", MQTT_SECRET); + // Never log the password or any part of MQTT_SECRET — serial/SD logs leave + // the device (support sessions, log downloads), and the secret derives every + // device's password. + LOG_INFO(TAG, "🔑 MQTT auth — user: %s (password derived)", mqttConfig.user.c_str()); LOG_DEBUG(TAG, "ConfigManager - Clean defaults initialized with auto-generated identifiers"); } diff --git a/src/ConfigManager/README.md b/src/ConfigManager/README.md index 59cd77d..eadf27b 100644 --- a/src/ConfigManager/README.md +++ b/src/ConfigManager/README.md @@ -201,7 +201,7 @@ All files live under `/settings/` on the FAT SD card. `device_uid`, `hw_type`, and `hw_version` are written only by the factory provisioning tool. If any of these keys are absent in NVS, `begin()` logs a critical warning and the device will use empty strings. MQTT auth will fail and subsystems that gate on `getDeviceUID()` will behave incorrectly. Reflash the NVS partition using `esptool` and the provisioning binary. **MQTT password is derived at boot, not stored.** -`computeMqttPassword()` runs HMAC-SHA256(`MQTT_SECRET`, `deviceUID`) and takes the first 16 bytes (32 hex chars). The build flag `MQTT_SECRET` must match the value in the backend `.env` exactly. A mismatch will cause MQTT `CONNACK` error 5 (Not Authorized). The secret is logged at `INFO` level on boot — remove or gate this log line before shipping. +`computeMqttPassword()` runs HMAC-SHA256(`MQTT_SECRET`, `deviceUID`) and takes the first 16 bytes (32 hex chars). The build flag `MQTT_SECRET` must match the value in the backend `.env` exactly. A mismatch will cause MQTT `CONNACK` error 5 (Not Authorized). Neither the password nor any part of the secret is logged (removed 2026-10-15); only the username is. **SD card is required for user settings.** `begin()` returns `false` if `SD.begin()` fails. All `load*()` and `save*()` methods silently return `false` when the card is absent. The HealthMonitor reports ConfigManager as unhealthy when `isHealthy()` returns false (SD unmounted or UID empty). This is classified as a WARNING, not CRITICAL, so the firmware continues running with in-RAM defaults.