Commit Graph

34271 Commits

Author SHA1 Message Date
jafarkhan83
13299a6203 Fixed #36898 -- Documented SessionBase.is_empty(). 2026-02-03 11:02:50 -05:00
Jacob Walls
af361d3be4 Added CVE-2025-13473, CVE-2025-14550, CVE-2026-1207, CVE-2026-1285, CVE-2026-1287, and CVE-2026-1312 to security archive. 2026-02-03 09:11:06 -05:00
Jacob Walls
e7e43f1f91 Added stub release notes for 6.0.3. 2026-02-03 09:05:18 -05:00
Jacob Walls
005d60d97c Refs CVE-2026-1312 -- Raised ValueError when FilteredRelation aliases contain periods.
This prevents failures at the database layer, given that aliases in the
ON clause are not quoted.

Systematically quoting aliases even in FilteredRelation is tracked in
https://code.djangoproject.com/ticket/36795.
2026-02-03 07:56:04 -05:00
Jacob Walls
69065ca869 Fixed CVE-2026-1312 -- Protected order_by() from SQL injection via aliases with periods.
Before, `order_by()` treated a period in a field name as a sign that it
was requested via `.extra(order_by=...)` and thus should be passed
through as raw table and column names, even if `extra()` was not used.
Since periods are permitted in aliases, this meant user-controlled
aliases could force the `order_by()` clause to resolve to a raw table
and column pair instead of the actual target field for the alias.

In practice, only `FilteredRelation` was affected, as the other
expressions we tested, e.g. `F`, aggressively optimize away the ordering
expressions into ordinal positions, e.g. ORDER BY 2, instead of ORDER BY
"table".column.

Thanks Solomon Kebede for the report, and Simon Charette and Jake Howard
for reviews.
2026-02-03 07:55:33 -05:00
Jake Howard
e891a84c7e Fixed CVE-2026-1287 -- Protected against SQL injection in column aliases via control characters.
Control characters in FilteredRelation column aliases could be used for
SQL injection attacks. This affected QuerySet.annotate(), aggregate(),
extra(), values(), values_list(), and alias() when using dictionary
expansion with **kwargs.

Thanks Solomon Kebede for the report, and Simon Charette, Jacob Walls,
and Natalia Bidart for reviews.
2026-02-03 07:55:04 -05:00
Natalia
a33540b3e2 Fixed CVE-2026-1285 -- Mitigated potential DoS in django.utils.text.Truncator for HTML input.
The `TruncateHTMLParser` used `deque.remove()` to remove tags from the
stack when processing end tags. With crafted input containing many
unmatched end tags, this caused repeated full scans of the tag stack,
leading to quadratic time complexity.

The fix uses LIFO semantics, only removing a tag from the stack when it
matches the most recently opened tag. This avoids linear scans for
unmatched end tags and reduces complexity to linear time.

Refs #30686 and 6ee37ada32.

Thanks Seokchan Yoon for the report, and Jake Howard and Jacob Walls for
reviews.
2026-02-03 07:54:16 -05:00
Jacob Walls
81aa529296 Fixed CVE-2026-1207 -- Prevented SQL injections in RasterField lookups via band index.
Thanks Tarek Nakkouch for the report, and Simon Charette for the initial
triage and review.
2026-02-03 07:53:50 -05:00
Jake Howard
eb22e1d6d6 Fixed CVE-2025-14550 -- Optimized repeated header parsing in ASGI requests.
Thanks Jiyong Yang for the report, and Natalia Bidart, Jacob Walls, and
Shai Berger for reviews.
2026-02-03 07:53:12 -05:00
Jake Howard
3eb814e02a Fixed CVE-2025-13473 -- Standardized timing of check_password() in mod_wsgi auth handler.
Refs CVE-2024-39329, #20760.

Thanks Stackered for the report, and Jacob Walls and Markus Holtermann
for the reviews.

Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2026-02-03 07:52:25 -05:00
ar3ph
72ae25a9c2 Fixed #36879 -- Identified Django client in Redis client metadata. 2026-02-03 06:40:29 -05:00
Jacob Walls
24a14860ce Fixed line length in admin_views test_prepopulated_fields(). 2026-02-02 22:22:04 -05:00
SnippyCodes
1d4c52c8bf Fixed #36893 -- Serialized elidable kwarg for RunSQL and RunPython operations. 2026-02-02 21:05:44 -05:00
Patryk Bratkowski
5798f4bb17 Fixed selenium tests in Firefox.
Unlike Chromium-based browsers, Firefox does not automatically scroll
elements into view when using the Actions API with move_to_element.
This calls the scrollIntoView function explicitly, which fixes
some selenium tests when not running in headless mode.
2026-02-02 14:53:30 -05:00
Jacob Walls
d725f6856d Refs #36788 -- Added missing CSS selector for fieldsets in the admin. 2026-02-02 08:15:13 -05:00
Jacob Walls
b665a67d61 Fixed #36788 -- Fixed horizontal form field alignment under <fieldset> in the admin.
Thanks Antoliny for the review.

Regression in 4187da258f.
2026-02-02 08:15:13 -05:00
Jacob Walls
986f7f2098 Added missing quotes around nonce in docs/ref/csp.txt. 2026-02-02 07:29:41 -05:00
Jacob Walls
674eda1c03 Refs #36865 -- Fixed test_exact_lookup_validates_each_field_independently() crash on databases that don't support primitives in JSONFields.
For example on Oracle < 21c.
2026-01-31 11:48:59 -05:00
Tim Graham
bb8c14b466 Added supports_expression_indexes skip to nulls_distinct test. 2026-01-31 16:26:27 +01:00
Jacob Walls
4a52533329 Refs #34118 -- Removed asgiref coroutine detection shims.
As Python 3.12 is now the floor, we can drop the shims and
use the `inspect` module.
2026-01-31 08:59:54 -05:00
Tim Schilling
93dfb16e96 Added documentation on reviewing patches.
Original inspiration drawn from Sarah Boyce's talk:
"Django needs you! (to do code review)"
2026-01-30 20:48:59 -05:00
Jacob Walls
cbc4c9f11f Fixed typos in docs/ref/models/querysets.txt. 2026-01-30 15:59:14 -05:00
Mark Niehues
08a0b92329 Fixed #36468 -- Fixed failure to close popup when adding a related object in the admin.
The issue manifested when there were multiple relations and only some
of them participated in a filter_horizontal.

Regression in cd0479ff76.
2026-01-30 14:07:16 -05:00
mlissner
4cecf30395 Fixed #36865 -- Removed casting from exact lookups in admin searches.
Instead of casting non-text fields to CharField (which prevents index
usage), skip exact lookups when the search term fails
formfield.to_python().

This preserves index usage for valid searches while gracefully handling
invalid search terms by simply not including them in the query for that
field.

For multi-term searches like 'foo 123' on search_fields=['name', 'age__exact']:
- 'foo': invalid for age, so only name lookup is used
- '123': valid for both, so both lookups are used

This entails a slight increase in permissiveness for search terms that
can be normalized by formfield.to_python().
2026-01-30 11:45:39 -05:00
mlissner
b25bc24418 Refs #36865 -- Added test for invalid value handling in admin changelist. 2026-01-30 11:45:39 -05:00
Natalia
f87c2055b4 Fixed spell checking in docs GitHub Actions workflow.
The spelling check job was passing even with spelling errors because
the system spell checker (`aspell`) was not installed on the GitHub
Actions runner. While `sphinxcontrib.spelling` and `PyEnchant` were
installed via pip, they require a system-level spell checker backend
to function.
2026-01-29 11:20:11 -03:00
Natalia
117ff1d37d Made explicit that aspell is a requirement to run spell checks on docs. 2026-01-29 11:20:11 -03:00
Natalia
ba96379011 Fixed docs spelling errors accumulated over time.
The `docs` GitHub action does not install `aspell` so the seplling
checks are always passing in CI. After installing it, the following
errors are reported:

WARNING: internals/security.txt:50: : Spell check: runnable: Include a runnable proof of concept.
WARNING: ref/contrib/postgres/search.txt:292: : Spell check: lexeme: an untrusted source. The content of each lexeme is escaped so that any.
WARNING: ref/contrib/postgres/search.txt:295: : Spell check: lexemes: You can combine lexemes with other lexemes using the .
WARNING: ref/contrib/postgres/search.txt:295: : Spell check: lexemes: You can combine lexemes with other lexemes using the .
WARNING: ref/contrib/postgres/search.txt:314: : Spell check: Lexeme: Lexeme objects also support term weighting and prefixes:.
WARNING: ref/models/database-functions.txt:1897: : Spell check: ai: 23ai/26ai (23.9) or later..
WARNING: ref/models/database-functions.txt:1897: : Spell check: ai: 23ai/26ai (23.9) or later..
WARNING: ref/models/expressions.txt:439: : Spell check: positionally:  can be supplied positionally or only by keyword. For.
WARNING: ref/models/fields.txt:1339: : Spell check: ai: PostgreSQL < 18 only supports persisted columns. Oracle < 23ai/26ai (23.7).
WARNING: ref/models/fields.txt:1339: : Spell check: ai: PostgreSQL < 18 only supports persisted columns. Oracle < 23ai/26ai (23.7).
WARNING: ref/models/fields.txt:1344: : Spell check: ai: s was added on Oracle 23ai/26ai.
WARNING: ref/models/fields.txt:1344: : Spell check: ai: s was added on Oracle 23ai/26ai.
WARNING: releases/4.2.21.txt:24: : Spell check: unclosed: exception if it encounters an unusually large number of unclosed opening tags..
WARNING: releases/5.1.9.txt:24: : Spell check: unclosed: exception if it encounters an unusually large number of unclosed opening tags..
WARNING: releases/5.2.1.txt:24: : Spell check: unclosed: exception if it encounters an unusually large number of unclosed opening tags..
WARNING: releases/6.1.txt:244: : Spell check: mistyped: suggestions for mistyped subcommand names and argument choices..
WARNING: releases/6.1.txt:281: : Spell check: ai: Oracle 23ai/26ai (23.7+)..
WARNING: releases/6.1.txt:281: : Spell check: ai: Oracle 23ai/26ai (23.7+)..
WARNING: releases/6.1.txt:343: : Spell check: durations: durations expressed in weeks (.
WARNING: Found 19 misspelled words
build finished with problems, 20 warnings (with warnings treated as errors).

This branch adds some of the words to the allowlist, but for others I
chose to rephrase the text in a more approachable manner.
2026-01-29 11:20:11 -03:00
Nilesh Kumar Pahari
fe189dc43a Fixed #36847 -- Ensured auto_now_add fields are set on pre_save().
Regression in 94680437a4. Refs #27222.

During INSERT operations, `field.pre_save()` is called to prepare values
for db insertion. The `add` param must be `True` for `auto_now_add`
fields to be populated. The regression commit passed `False`, causing
`auto_now_add` fields to remain `None` when used by other fields, such
as `upload_to` callables.

Thanks Ran Benita for the report.
2026-01-29 10:11:33 -03:00
Samriddha9619
2831eaed79 Fixed #36233 -- Avoided quantizing integers stored in DecimalField on SQLite.
Co-authored-by: Simon Charette <charette.s@gmail.com>
Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
2026-01-28 17:04:39 -05:00
Jacob Walls
e61a54d306 Doc'd the minimum version of bash for releasing Django. 2026-01-28 16:51:29 -05:00
Markus Holtermann
83622b824b Fixed #36878 -- Unified data type for *_together options in ModelState.
Ever since the beginning of Django's migration framework, there's been a
bit of an inconsistency on how index_together and unique_together values
have been stored on the ModelState[^1].

It's only really obvious, when looking at the current code for
`from_model()`[^2] and the `rename_field()` state alteration code[^3].

The problem in the autodetector's detection of the `*_together` options
as raised in the ticket, reinforces the inconsistency[^4]: the old value
is being normalized to a set of tuples, whereas the new value is taken
as-is.

Why this hasn't been caught before, is likely to the fact, that we
never really look at a `to_state` that comes from migration operations
in the autodetector. Instead, in both usages in Django[^5], [^6] the
`to_state` is a `ProjectState.from_apps()`. And that state is
consistently using sets of tuples and not lists of lists.

[^1]: 67dcea711e (diff-5dd147e9e978e645313dd99eab3a7bab1f1cb0a53e256843adb68aeed71e61dcR85-R87)
[^2]: b1ffa9a9d7/django/db/migrations/state.py (L842)
[^3]: b1ffa9a9d7/django/db/migrations/state.py (L340-L345)
[^4]: b1ffa9a9d7/django/db/migrations/autodetector.py (L1757-L1771)
[^5]: 2351c1b12c/django/core/management/commands/makemigrations.py (L215-L219)
[^6]: 2351c1b12c/django/core/management/commands/migrate.py (L329-L332)
2026-01-28 16:13:05 -05:00
Tim Graham
5d5f95da40 Refs #35744 -- Removed problematic __in lookup in test_intersection_in_nested_subquery.
It's problematic on MongoDB. Simon: "It seems odd that we'd use
__in=OuterRef("pk") over __in=[OuterRef("pk")]. It's a SQLism that
only works because right-hand-side is wrapped with (...) and that's
interpreted as a singleton tuple which is allowed with IN."
2026-01-27 20:18:50 -05:00
Jacob Walls
b30e09a942 Added stub release notes and release date for 6.0.2, 5.2.11, and 4.2.28. 2026-01-27 15:31:24 -05:00
jafarkhan83
2e83eb5e78 Fixed #36776 -- Clarified dev server runs in WSGI mode. 2026-01-26 10:45:40 -05:00
varunkasyap
229d026207 Fixed #36883 -- Split monolithic aggregation regression tests. 2026-01-26 10:37:11 -05:00
Nilesh Kumar Pahari
e92d1e3b78 Fixed #36850 -- Prevented admin filter sidebar from wrapping below the changelist.
Removed flex-wrap from .changelist-form-container and added min-width to the
main content container to ensure proper layout behavior.
Regression in 6ea3319079.
2026-01-26 10:25:47 -05:00
Skyiesac
c3c9f1908e Fixed #36812 -- Dropped support for MariaDB < 10.11. 2026-01-25 09:19:43 +01:00
Jacob Walls
68d110f1fe Refs #33735 -- Coped with stacklevel change in ASGITest.test_file_response().
Follow-up to c042fe3a74.

The original ignore was added in 0bd2c0c901
but was not adjusted when the stacklevel changed.
2026-01-23 13:16:30 -05:00
Jacob Walls
2351c1b12c Refs #36620 -- Ran coverage tests workflow on forks.
We can continue to limit the coverage comment workflow to django/django,
but now that this workflow is the main python test workflow, it should
run on forks by default. The other tests workflow (currently running
only JavaScript tests) may start running python tests again once we flesh
out the matrix, but since it was duplicating the coverage tests configuration,
we temporarily removed it.

Follow-up to 26b0e2bb92.
2026-01-23 10:13:11 -05:00
seanhelvey
b1ffa9a9d7 Fixed #13883 -- Rendered named choice groups with <optgroup> in FilteredSelectMultiple.
This patch adds support for <optgroup>s in FilteredSelectMultiple widgets.
When a popup returns a new object, if the source field contains optgroup
choices, the optgroup is now also included in the response data.

Additionally, this adds error handling for invalid source_model parameters
to prevent crashes and display user-friendly error messages instead.

Co-authored-by: Michael McLarnon <mmclar@gmail.com>
2026-01-22 21:12:23 -05:00
Jacob Walls
3851601b2e Refs #36382 -- Fixed GDAL_VERSION comparison in gdal_tests.
Tests regression in 0d31ca9883.
2026-01-20 11:54:07 -05:00
VIZZARD-X
e083c62f51 Fixed #36030 -- Fixed precision loss in division of Decimal literals on SQLite.
Thanks Bob Kline for the review.
2026-01-20 10:42:28 -05:00
Skyiesac
e5cbb8b4be Fixed #36639 -- Added CI step to run makemigrations --check against test models. 2026-01-20 10:40:53 -05:00
Skyiesac
748c2ba837 Refs #36639 -- Updated test migrations to match models. 2026-01-20 10:40:53 -05:00
James Fysh
59fcd2a199 Fixed #36869 -- Optimized MigrationGraph._generate_plan membership checks.
Previously, `_generate_plan()` relied on list membership checks,
resulting in quadratic behavior as the plan grew. On large migration
graphs this became a significant performance bottleneck.

This change uses `OrderedSet` for the plan, reducing the complexity to
linear while preserving insertion order and behavior.

Co-authored-by: Nick Pope <nick@nickpope.me.uk>
2026-01-19 16:08:34 -03:00
Clifford Gama
d6cca8b904 Refs #25508 -- Updated outdated QuerySet.__repr__() results. 2026-01-19 09:58:43 -05:00
Clifford Gama
2541641347 Fixed unbalanced parentheses in docs. 2026-01-19 08:39:25 -05:00
Mariusz Felisiak
899eee3883 Ignored 6cff020787 formatting changes in git blame. 2026-01-19 10:00:34 +01:00
Mariusz Felisiak
6cff020787 Applied Black's 2026 stable style.
https://github.com/psf/black/releases/tag/26.1.0
2026-01-18 21:26:56 +01:00