{
  "id": "python/django-query-parameter-injection",
  "signature": "django.core.exceptions.SuspiciousOperation: Invalid HTTP_HOST header: 'evil.com'.",
  "signature_zh": "可疑操作：无效的 HTTP_HOST 头",
  "regex": "django\\.core\\.exceptions\\.SuspiciousOperation:\\ Invalid\\ HTTP_HOST\\ header:\\ 'evil\\.com'\\.",
  "domain": "python",
  "category": "auth_error",
  "subcategory": null,
  "root_cause": "请求中的 Host 头不匹配 ALLOWED_HOSTS 设置",
  "root_cause_type": "generic",
  "root_cause_zh": "Django 验证 Host 头时发现不在允许列表中",
  "versions": [
    {
      "version": "3.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "4.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "5.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "在 ALLOWED_HOSTS 中添加通配符 '*'",
      "why_fails": "降低安全性，允许任意 Host 头，可能导致 HTTP Host 头攻击",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "忽略错误继续处理",
      "why_fails": "Django 会抛出 SuspiciousOperation 异常，无法忽略",
      "fail_rate": 1.0,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "在 ALLOWED_HOSTS 中列出有效域名",
      "success_rate": 1.0,
      "how": "ALLOWED_HOSTS = ['example.com', 'www.example.com']",
      "condition": "",
      "sources": []
    },
    {
      "action": "使用环境变量配置",
      "success_rate": 0.95,
      "how": "ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', '').split(',')",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-07-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}