mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-01 12:02:05 +00:00
fix(cli): redact status API keys with --all
This commit is contained in:
parent
a8841e2a68
commit
c080a530ae
2 changed files with 7 additions and 7 deletions
|
|
@ -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}")
|
||||
|
||||
# =========================================================================
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue