Skip to content

Keep passwords, meter keys and tokens out of the debug log - #1328

Merged
gskjold merged 2 commits into
mainfrom
fix/no-credentials-in-logs
Dec 4, 2026
Merged

gskjold merged 2 commits into
mainfrom
fix/no-credentials-in-logs

Conversation

@gskjold

@gskjold gskjold commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Why

The debug log can be read over telnet (RemoteDebug) and the serial port, and it contained secrets:

  • Failed web login: logged the submitted Authorization value. That is only base64, so a mistyped or guessed password was readable (checkSecurity()).
  • /save at debug level: logged every form value. That includes the WiFi, MQTT and web passwords, the meter encryption and authentication keys, and the ENTSO-E and ZmartCharge tokens.
  • Configuration dump at boot (AmsConfiguration::print()): printed the WiFi, MQTT and web passwords and both tokens.

Changes

  • A failed login now logs only Unsuccessful login.
  • The /save argument dump is removed completely. Masking only some fields would still log the rest of the configuration on every save, and any secret field added later would be logged in clear.
  • The configuration dump at boot shows *** for the WiFi, MQTT and web passwords and the ENTSO-E and ZmartCharge tokens when they are set, and empty when they are not, so you can still see whether they are configured.

Verification

  • pio run for esp8266dev, esp32dev and esp32s2dev.
  • pio test -e native_config passes.
  • The log output has not been checked on a device.

🤖 Generated with Claude Code

gskjold and others added 2 commits November 23, 2026 11:42
The debug log, which can be read over telnet, contained secrets:

- a failed web login logged the submitted Basic credential, which is only
  base64 encoded, so a mistyped or guessed password was readable
- /save at debug level logged every form value, including the WiFi, MQTT and
  web passwords, meter keys and tokens
- the configuration dump at boot printed the WiFi, MQTT and web passwords and
  the ENTSO-E and ZmartCharge tokens

Log the failed login without the credential and show these values as ***.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Masking the secret fields still logged the rest of the configuration on
every save, and any field added later would be logged in clear until someone
remembered to add it to the list. Drop the argument dump.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown

🔧 PR Build Artifacts

Version: 86fa714

All environments built successfully. Download the zip files:

Artifacts expire after 7 days. View workflow run

@gskjold gskjold added this to the v2.6.1 milestone Nov 26, 2026
@gskjold
gskjold merged commit 7ac175a into main Dec 4, 2026
8 checks passed
@gskjold
gskjold deleted the fix/no-credentials-in-logs branch December 4, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant