mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2026-10-31 22:02:17 +01:00
fix: stop sending stored passwords and PIN back to clients
The settings routes returned the WiFi passphrase, MQTT password and the login password and PIN in plain text, and the debug log printed them and the API key. Responses now carry hasPassphrase/hasPassword/hasPin flags, logs mask the values, and an omitted secret keeps the stored one. The UI loads secret fields empty and treats a blank field as "keep" while the SSID or username is unchanged. Clearing a secret without changing the SSID or username is listed in docs/KNOWN_ISSUES.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e963a5adb3
commit
1fb4c4cfcd
8 changed files with 189 additions and 29 deletions
|
|
@ -125,7 +125,6 @@ bool Web::createAPIToken(const char *payload, char *token) {
|
|||
sprintf(str, "%02x", (int)hmacResult[i]);
|
||||
strcat(token, str);
|
||||
}
|
||||
ESP_LOGD(TAG, "Hash: %s", token);
|
||||
return true;
|
||||
}
|
||||
bool Web::createAPIToken(const IPAddress ipAddress, char *token) {
|
||||
|
|
|
|||
|
|
@ -621,7 +621,6 @@ void registerWebUiRoutes(AsyncWebServer &server) {
|
|||
resp.beginObject();
|
||||
resp.beginObject("connected");
|
||||
resp.addElem("name", settings.WIFI.ssid);
|
||||
resp.addElem("passphrase", settings.WIFI.passphrase);
|
||||
resp.addElem("strength", (int32_t)WiFi.RSSI());
|
||||
resp.addElem("channel", (int32_t)WiFi.channel());
|
||||
resp.endObject();
|
||||
|
|
@ -834,7 +833,8 @@ void registerWebUiRoutes(AsyncWebServer &server) {
|
|||
JsonObject obj = json.as<JsonObject>();
|
||||
ESP_LOGD(TAG, "Settings WIFI connection...");
|
||||
String ssid = "";
|
||||
String passphrase = "";
|
||||
// Clients never receive the stored passphrase, so an omitted one keeps it.
|
||||
String passphrase = settings.WIFI.passphrase;
|
||||
if(!obj["ssid"].isNull()) ssid = obj["ssid"].as<String>();
|
||||
if(!obj["passphrase"].isNull()) passphrase = obj["passphrase"].as<String>();
|
||||
bool reboot = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue