The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(debug): strict URL-credential redaction for the system dump
JoaoMarcos44205d5d78f1ff
diff --git a/agent/redact.py b/agent/redact.pyindex cab7396ea71..4e3c377813f 100644--- a/agent/redact.py+++ b/agent/redact.py@@ -740,7 +740,10 @@ def _canonical_url_param_name(name: str) -> str:if next_value == decoded:breakdecoded = next_value- return decoded.casefold().replace("-", "_")+ folded = decoded.casefold()+ # Preserve policy names that are canonically hyphenated (for example+ # x-amz-signature) before accepting underscore-normalized aliases.+ return folded if folded in _SENSITIVE_QUERY_PARAMS else folded.replace("-", "_")def _redact_strict_url_credentials(text: str) -> str:diff --git a/hermes_cli/debug.py b/hermes_cli/debug.pyindex 873379efa44..6de6cfed832 100644--- a/hermes_cli/debug.py+++ b/hermes_cli/debug.py@@ -256,13 +256,15 @@ def _resolve_log_path(log_name: str) -> Optional[Path]:return None-def _redact_log_text(text: str) -> str:+def _redact_log_text(text: str, *, redact_url_credentials: bool = False) -> str:"""``redact_sensitive_text(force=True)`` + email scrub — fires regardless of the operator's``security.redact_secrets`` setting; only the in-memory upload copy is sanitized."""if not text:return textfrom agent.redact import redact_sensitive_text- text = redact_sensitive_text(text, force=True)+ text = redact_sensitive_text(+ text, force=True, redact_url_credentials=redact_url_credentials+ )return _EMAIL_ADDRESS_RE.sub("[REDACTED_EMAIL]", text)@@ -347,13 +349,15 @@ def _capture_default_log_snapshots(def _capture_dump(redact: bool = True) -> str:- """Run ``hermes dump`` and return its stdout, force-redacted like the logs unless *redact* is- False: the dump is upload-bound and quotes config values (e.g. ``fallback_providers``)."""+ """Run ``hermes dump`` and return its stdout, force-redacted unless *redact* is False: the dump+ is upload-bound and quotes config values (e.g. ``fallback_providers``), so URL credentials are+ redacted too, unlike the logs (whose policy spares OAuth/magic-link URLs)."""from hermes_cli.dump import run_dumpcapture = io.StringIO()with contextlib.redirect_stdout(capture), contextlib.suppress(SystemExit):run_dump(SimpleNamespace(show_keys=False))- return _redact_log_text(capture.getvalue()) if redact else capture.getvalue()+ text = capture.getvalue()+ return _redact_log_text(text, redact_url_credentials=True) if redact else textdef collect_debug_report(diff --git a/hermes_cli/dump.py b/hermes_cli/dump.pyindex 0411bbdf9ca..4c56e76e0e3 100644--- a/hermes_cli/dump.py+++ b/hermes_cli/dump.py@@ -182,7 +182,9 @@ def _config_overrides(config: dict) -> dict[str, str]:if fallbacks:# Entries carry api_key; the dump is made to be pasted, so it never prints a secret.from agent.redact import redact_sensitive_text- overrides["fallback_providers"] = redact_sensitive_text(str(fallbacks), force=True)+ overrides["fallback_providers"] = redact_sensitive_text(+ str(fallbacks), force=True, redact_url_credentials=True+ )return overrides