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
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue