国内可访问服务替换排查:新增蜜罐反垃圾字段 + CDN 加速域名配置

This commit is contained in:
2026-08-07 14:49:00 +08:00
parent d6503bb46f
commit 16e4f97e74
6 changed files with 38 additions and 3 deletions
+20
View File
@@ -80,6 +80,26 @@ def test_lead_submit_requires_form_id():
assert response.status_code == 400
def test_lead_submit_honeypot_filled_silently_rejects_without_creating_lead(
contact_form,
):
"""蜜罐字段非空视为机器人:返回“成功”假象但不落库、不发通知邮件。"""
client = APIClient()
response = client.post(
"/api/v1/custom/leads/",
{
"form_id": contact_form.pk,
"data": {"name": "张三"},
"website": "http://spam.example.com",
},
format="json",
)
assert response.status_code == 201
assert response.data["success"] is True
assert not Lead.objects.exists()
# --- PIPL 数据删除权(详见设计文档 §2.15) ---