fix(redact): safely handle non-string inputs (salvage #2369)

fix(redact): safely handle non-string inputs (salvage #2369)
This commit is contained in:
Teknium 2026-03-21 17:10:14 -07:00 committed by GitHub
commit 1d28b4699b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View file

@ -100,6 +100,10 @@ def redact_sensitive_text(text: str) -> str:
Safe to call on any string -- non-matching text passes through unchanged.
Disabled when security.redact_secrets is false in config.yaml.
"""
if text is None:
return None
if not isinstance(text, str):
text = str(text)
if not text:
return text
if os.getenv("HERMES_REDACT_SECRETS", "").lower() in ("0", "false", "no", "off"):