feat: complete customer service safety and handover flow
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
from app.core.conversation_privacy import sanitize_customer_service_message
|
||||
|
||||
|
||||
def test_customer_service_message_hides_sensitive_credentials_before_storage() -> None:
|
||||
"""敏感值不得进入客服会话持久化和后续异步处理链。"""
|
||||
message = (
|
||||
"登录密码: Secret123;验证码 123456;身份证 11010519491231002X;"
|
||||
"银行卡 6222021234567890123;手机号 13812345678"
|
||||
)
|
||||
|
||||
sanitized = sanitize_customer_service_message(message)
|
||||
|
||||
assert "Secret123" not in sanitized
|
||||
assert "123456" not in sanitized
|
||||
assert "11010519491231002X" not in sanitized
|
||||
assert "6222021234567890123" not in sanitized
|
||||
assert "13812345678" not in sanitized
|
||||
assert "登录密码" in sanitized
|
||||
assert "验证码" in sanitized
|
||||
|
||||
|
||||
def test_customer_service_message_keeps_ordinary_password_question_unchanged() -> None:
|
||||
"""普通业务咨询不应被误判为用户实际提交的密码。"""
|
||||
message = "忘记登录密码怎么办?"
|
||||
|
||||
assert sanitize_customer_service_message(message) == message
|
||||
Reference in New Issue
Block a user