From c080a530ae4c7ead0dd4e7309b0e1a05cb9c5ce5 Mon Sep 17 00:00:00 2001 From: Vladimir Smirnov Date: Sat, 25 Apr 2026 23:12:29 +0300 Subject: [PATCH] fix(cli): redact status API keys with --all --- hermes_cli/status.py | 5 ++--- tests/hermes_cli/test_status.py | 9 +++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hermes_cli/status.py b/hermes_cli/status.py index 42c8a953156..27ecf654d0c 100644 --- a/hermes_cli/status.py +++ b/hermes_cli/status.py @@ -91,7 +91,6 @@ from hermes_constants import is_termux as _is_termux def show_status(args): """Show status of all Hermes Agent components.""" - show_all = getattr(args, 'all', False) deep = getattr(args, 'deep', False) print() @@ -165,12 +164,12 @@ def show_status(args): continue value = _resolve_env(env_ref) has_key = bool(value) - display = redact_key(value) if not show_all else value + display = redact_key(value) print(f" {name:<12} {check_mark(has_key)} {display}") from hermes_cli.auth import get_anthropic_key anthropic_value = get_anthropic_key() - anthropic_display = redact_key(anthropic_value) if not show_all else anthropic_value + anthropic_display = redact_key(anthropic_value) print(f" {'Anthropic':<12} {check_mark(bool(anthropic_value))} {anthropic_display}") # ========================================================================= diff --git a/tests/hermes_cli/test_status.py b/tests/hermes_cli/test_status.py index 89607a80276..8b09dd8377a 100644 --- a/tests/hermes_cli/test_status.py +++ b/tests/hermes_cli/test_status.py @@ -3,15 +3,16 @@ from types import SimpleNamespace from hermes_cli.status import show_status -def test_show_status_includes_tavily_key(monkeypatch, capsys, tmp_path): +def test_show_status_all_does_not_print_tavily_key_value(monkeypatch, capsys, tmp_path): monkeypatch.setenv("HERMES_HOME", str(tmp_path)) - monkeypatch.setenv("TAVILY_API_KEY", "tvly-1234567890abcdef") + sentinel = "NONSECRET_SENTINEL_VALUE_DO_NOT_PRINT_123456" + monkeypatch.setenv("TAVILY_API_KEY", sentinel) - show_status(SimpleNamespace(all=False, deep=False)) + show_status(SimpleNamespace(all=True, deep=False)) output = capsys.readouterr().out assert "Tavily" in output - assert "tvly...cdef" in output + assert sentinel not in output def test_show_status_termux_gateway_section_skips_systemctl(monkeypatch, capsys, tmp_path):