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

*2024 年 9 月 3 日*

Django 5.1.1 修复了 5.1 中一个严重程度为“中等”的安全问题、一个严重程度为“低”的安全问题以及多个错误。

## CVE-2024-45230: `django.utils.html.urlize()` 中潜在的拒绝服务漏洞

[`urlize`](/zh-hans/6.0/ref/templates/builtins/#std-templatefilter-urlize) 和 [`urlizetrunc`](/zh-hans/6.0/ref/templates/builtins/#std-templatefilter-urlizetrunc) 可能会因包含特定字符序列的非常大的输入而遭受潜在的拒绝服务攻击。

## CVE-2024-45231: 通过密码重置的响应状态可能导致用户邮箱枚举

由于未处理的电子邮件发送失败，[`PasswordResetForm`](/zh-hans/6.0/topics/auth/default/#django.contrib.auth.forms.PasswordResetForm) 类允许远程攻击者通过发出密码重置请求并观察结果来枚举用户邮箱。

为了缓解此风险，现在使用 [django.contrib.auth](/zh-hans/6.0/ref/logging/#django-contrib-auth-logger) 日志记录器处理和记录密码重置电子邮件发送过程中发生的异常。

## 漏洞修复

- 修复了 Django 5.1 中的一个回归问题，该问题导致在将空序列传递给 `order_by` 参数时 `Window()` 崩溃，以及在未排序的情况下对切片查询集使用 `Prefetch()` 时崩溃（[#35665](https://code.djangoproject.com/ticket/35665)）。
- 修复了 Django 5.1 中的一个回归问题，该问题导致 ``` BaseUserCreationForm`（及其子类）中包含一个新的 ``usable_password` ``` 字段。添加了一个包含此字段的新 [`AdminUserCreationForm`](/zh-hans/6.0/topics/auth/default/#django.contrib.auth.forms.AdminUserCreationForm)，将该功能隔离到管理界面中（[#35678](https://code.djangoproject.com/ticket/35678)）。
- 调整了 [`Model.save()`](/zh-hans/6.0/ref/models/instances/#django.db.models.Model.save) 和 [`Model.asave()`](/zh-hans/6.0/ref/models/instances/#django.db.models.Model.asave) 中的弃用警告 `stacklevel`，以正确指向有问题的调用位置（[#35060](https://code.djangoproject.com/ticket/35060)）。
- 调整了在 [`FileSystemStorage`](/zh-hans/6.0/ref/files/storage/#django.core.files.storage.FileSystemStorage) 中使用 `OS_OPEN_FLAGS` 时的弃用警告 `stacklevel`，以正确指向有问题的调用位置（[#35326](https://code.djangoproject.com/ticket/35326)）。
- 调整了 `FieldCacheMixin.get_cache_name()` 中的弃用警告 `stacklevel`，以正确指向有问题的调用位置（[#35405](https://code.djangoproject.com/ticket/35405)）。
- 修复了 Django 5.1 中的一个回归问题，恢复了在 PostgreSQL 后端的 `init_connection_state` 方法中覆盖时区和角色设置行为的能力（[#35688](https://code.djangoproject.com/ticket/35688)）。
- 修复了 Django 5.1 中的一个错误，该错误导致在渲染管理界面字段集时记录变量查找错误（[#35716](https://code.djangoproject.com/ticket/35716)）。
