[core] Fix ANSI codes for secret text hiding (#15521)

This commit is contained in:
Jonathan Swoboda
2026-04-07 22:02:36 -04:00
committed by GitHub
parent c7513b9262
commit 8ffe0f5e31
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -1083,7 +1083,7 @@ def command_config(args: ArgsProtocol, config: ConfigType) -> int | None:
# add the console decoration so the front-end can hide the secrets
if not args.show_secrets:
output = re.sub(
r"(password|key|psk|ssid)\: (.+)", r"\1: \\033[5m\2\\033[6m", output
r"(password|key|psk|ssid)\: (.+)", r"\1: \\033[8m\2\\033[28m", output
)
if not CORE.quiet:
safe_print(output)
+2 -2
View File
@@ -54,8 +54,8 @@ namespace esphome {
#define ESPHOME_LOG_COLOR_CYAN "36" // DEBUG
#define ESPHOME_LOG_COLOR_GRAY "37" // VERBOSE
#define ESPHOME_LOG_COLOR_WHITE "38"
#define ESPHOME_LOG_SECRET_BEGIN "\033[5m"
#define ESPHOME_LOG_SECRET_END "\033[6m"
#define ESPHOME_LOG_SECRET_BEGIN "\033[8m"
#define ESPHOME_LOG_SECRET_END "\033[28m"
#define LOG_SECRET(x) ESPHOME_LOG_SECRET_BEGIN x ESPHOME_LOG_SECRET_END
#define ESPHOME_LOG_COLOR(COLOR) "\033[0;" COLOR "m"