fix(redact): safely handle non-string inputs (salvage #2369)
fix(redact): safely handle non-string inputs (salvage #2369)
This commit is contained in:
@@ -124,6 +124,13 @@ class TestPassthrough:
|
||||
def test_none_returns_none(self):
|
||||
assert redact_sensitive_text(None) is None
|
||||
|
||||
def test_non_string_input_int_coerced(self):
|
||||
assert redact_sensitive_text(12345) == "12345"
|
||||
|
||||
def test_non_string_input_dict_coerced_and_redacted(self):
|
||||
result = redact_sensitive_text({"token": "sk-proj-abc123def456ghi789jkl012"})
|
||||
assert "abc123def456" not in result
|
||||
|
||||
def test_normal_text_unchanged(self):
|
||||
text = "Hello world, this is a normal log message with no secrets."
|
||||
assert redact_sensitive_text(text) == text
|
||||
|
||||
Reference in New Issue
Block a user