---
title: "Django 2.1.11 版本发行说明"
version: 6.0
locale: zh-hans
source: https://docs.djangoproject.com/zh-hans/6.0/releases/2.1.11/
canonical: https://djangodocs.dev/zh-hans/6.0/releases/2.1.11/
---
# Django 2.1.11 版本发行说明

*2019 年 8 月 1 日*

Django 2.1.11 修复了 2.1.10 版本中的安全问题。

## CVE-2019-14232: `django.utils.text.Truncator` 中存在拒绝服务可能性问题。

如果 `django.utils.text.Truncator` 的 `chars()` 和 `words()` 方法传递了 `html=True` 参数，它们在处理某些输入时非常慢，这是由于正则表达式中的灾难性回溯漏洞引起的。`chars()` 和 `words()` 方法用于实现 [`truncatechars_html`](/zh-hans/6.0/ref/templates/builtins/#std-templatefilter-truncatechars_html) 和 [`truncatewords_html`](/zh-hans/6.0/ref/templates/builtins/#std-templatefilter-truncatewords_html) 模板过滤器，因此这两个过滤器也存在漏洞。

为了避免潜在的回溯问题，`Truncator` 使用的正则表达式已经简化。因此，尾部的标点符号可能会有时包含在截断后的输出中。

## CVE-2019-14233: `strip_tags()` 中存在拒绝服务可能性问题。

由于底层的 `HTMLParser` 的行为，[`django.utils.html.strip_tags()`](/zh-hans/6.0/ref/utils/#django.utils.html.strip_tags) 在处理包含大量嵌套不完整 HTML 实体序列的某些输入时会变得非常慢。`strip_tags()` 方法用于实现相应的 [`striptags`](/zh-hans/6.0/ref/templates/builtins/#std-templatefilter-striptags) 模板过滤器，因此这两个过滤器也存在漏洞。

现在，`strip_tags()` 在删除标签时避免了对 `HTMLParser` 的递归调用，但当进度停止删除标签但仍存在不完整的 HTML 实体时，它会继续运行。

请记住，`strip_tags()` 的结果绝对不保证是安全的 HTML。因此，在将 `strip_tags()` 调用的结果标记为安全之前，绝对不要忘记首先进行转义，例如使用 [`django.utils.html.escape()`](/zh-hans/6.0/ref/utils/#django.utils.html.escape)。

## CVE-2019-14234: 在 `JSONField`/`HStoreField` 的键和索引查找中存在 SQL 注入可能性。

`django.contrib.postgres.fields.JSONField` 的 [`键和索引查找`](/zh-hans/6.0/topics/db/queries/#std-fieldlookup-jsonfield.key)，以及 [`HStoreField`](/zh-hans/6.0/ref/contrib/postgres/fields/#django.contrib.postgres.fields.HStoreField) 的 [`键查找`](/zh-hans/6.0/ref/contrib/postgres/fields/#std-fieldlookup-hstorefield.key)，都受到了 SQL 注入的影响，使用适当构造的字典，并将其作为传递给 `QuerySet.filter()` 的 `**kwargs` 进行字典扩展。

## CVE-2019-14235: `django.utils.encoding.uri_to_iri()` 中存在潜在的内存耗尽问题。

如果传递了特定的输入，[`django.utils.encoding.uri_to_iri()`](/zh-hans/6.0/ref/utils/#django.utils.encoding.uri_to_iri) 在重新百分号编码无效的 UTF-8 八位序列时可能会导致显着的内存使用，因为它会发生过多的递归。

现在，`uri_to_iri()` 在重新百分号编码无效的 UTF-8 八位序列时避免了递归。
