fix(redact): safely handle non-string inputs (salvage #2369)
fix(redact): safely handle non-string inputs (salvage #2369)
This commit is contained in:
commit
1d28b4699b
2 changed files with 11 additions and 0 deletions
|
|
@ -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"):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue