10088 Commits

Author SHA1 Message Date
Mariusz Felisiak
837ffcfa68
[2.2.x] Refs #32856 -- Doc'd that psycopg2 < 2.9 is required. 2021-06-21 13:06:31 +02:00
Mariusz Felisiak
f27c38ab5d [2.2.x] Fixed CVE-2021-33571 -- Prevented leading zeros in IPv4 addresses.
validate_ipv4_address() was affected only on Python < 3.9.5, see [1].
URLValidator() uses a regular expressions and it was affected on all
Python versions.

[1] https://bugs.python.org/issue36384
2021-06-02 10:26:22 +02:00
Florian Apolloner
053cc9534d [2.2.x] Fixed CVE-2021-33203 -- Fixed potential path-traversal via admindocs' TemplateDetailView. 2021-06-02 10:26:22 +02:00
Mariusz Felisiak
63f0d7a0f6 [2.2.x] Refs #32718 -- Fixed file_storage.test_generate_filename and model_fields.test_filefield tests on Python 3.5. 2021-05-14 06:59:11 +02:00
Mariusz Felisiak
b8ecb06436 [2.2.x] Fixed #32718 -- Relaxed file name validation in FileField.
- Validate filename returned by FileField.upload_to() not a filename
  passed to the FileField.generate_filename() (upload_to() may
  completely ignored passed filename).
- Allow relative paths (without dot segments) in the generated filename.

Thanks to Jakub Kleň for the report and review.
Thanks to all folks for checking this patch on existing projects.
Thanks Florian Apolloner and Markus Holtermann for the discussion and
implementation idea.

Regression in 0b79eb36915d178aef5c6a7bbce71b1e76d376d3.

Backport of b55699968fc9ee985384c64e37f6cc74a0a23683 from main.
2021-05-13 09:00:25 +02:00
Mariusz Felisiak
d9594c4ea5 [2.2.x] Fixed #32713, Fixed CVE-2021-32052 -- Prevented newlines and tabs from being accepted in URLValidator on Python 3.9.5+.
In Python 3.9.5+ urllib.parse() automatically removes ASCII newlines
and tabs from URLs [1, 2]. Unfortunately it created an issue in
the URLValidator. URLValidator uses urllib.urlsplit() and
urllib.urlunsplit() for creating a URL variant with Punycode which no
longer contains newlines and tabs in Python 3.9.5+. As a consequence,
the regular expression matched the URL (without unsafe characters) and
the source value (with unsafe characters) was considered valid.

[1] https://bugs.python.org/issue43882 and
[2] 76cd81d603

Backport of e1e81aa1c4427411e3c68facdd761229ffea6f6f from main.
2021-05-06 08:53:27 +02:00
Carlton Gibson
163700388c [2.2.x] Refs CVE-2021-31542 -- Skipped mock AWS storage test on Windows.
The validate_file_name() sanitation introduced in
0b79eb36915d178aef5c6a7bbce71b1e76d376d3 correctly rejects the example
file name as containing path elements on Windows. This breaks the test
introduced in 914c72be2abb1c6dd860cb9279beaa66409ae1b2 to allow path
components for storages that may allow them.

Test is skipped pending a discussed storage refactoring to support this
use-case.

Backport of a708f39ce67af174df90c5b5e50ad1976cec7cb8 from main
2021-05-06 07:44:15 +02:00
Florian Apolloner
04ac1624bd [2.2.x] Fixed CVE-2021-31542 -- Tightened path & file name sanitation in file uploads. 2021-04-27 19:10:08 +02:00
Mariusz Felisiak
4036d62bda [2.2.x] Fixed CVE-2021-28658 -- Fixed potential directory-traversal via uploaded files.
Thanks Claude Paroz for the initial patch.
Thanks Dennis Brinkrolf for the report.

Backport of d4d800ca1addc4141e03c5440a849bb64d1582cd from main.
2021-04-06 08:38:19 +02:00
Nick Pope
fd6b6afd59 [2.2.x] Fixed CVE-2021-23336 -- Fixed web cache poisoning via django.utils.http.limited_parse_qsl(). 2021-02-18 10:27:25 +01:00
Mariusz Felisiak
21e7622dec [2.2.x] Fixed CVE-2021-3281 -- Fixed potential directory-traversal via archive.extract().
Thanks Florian Apolloner, Shai Berger, and Simon Charette for reviews.

Thanks Wang Baohua for the report.

Backport of 05413afa8c18cdb978fcdf470e09f7a12b234a23 from master.
2021-02-01 09:14:54 +01:00
Mariusz Felisiak
ee9d623831 [2.2.x] Fixed GeoIPTest.test04_city() failure with the latest GeoIP2 database.
Backport of 135c800fe6138d7818501a384c0ebbdc5442762c from master
2021-01-29 11:03:59 +01:00
Max Smolens
e893c0ad8b [2.2.x] Fixed #31850 -- Fixed BasicExtractorTests.test_extraction_warning with xgettext 0.21+.
"format string with unnamed arguments cannot be properly localized"
warning is not raised in xgettext 0.21+.

This patch uses a message that causes an xgettext warning regardless of
the version.

Backport of 07a30f561661efae1691ff45d10ec6014b395b58 from master
2020-11-02 10:30:40 +01:00
Jon Dufresne
01742aa932 [2.2.x] Refs #31040 -- Fixed Python PendingDeprecationWarning in select_for_update.tests.
Backport of 0dd2308cf6f559a4f4b50edd7c005c7cf025d1aa from master
2020-10-12 12:21:33 +02:00
Mariusz Felisiak
87b9a8b4de [2.2.x] Refs #31040 -- Fixed crypt.crypt() call in test_hashers.py.
An empty string is invalid salt in Python 3 and raises exception since
Python 3.9, see https://bugs.python.org/issue38402.
Backport of 1960d55f8baa412b43546d15a8342554808fff57 from master
2020-10-07 09:16:58 +02:00
Mariusz Felisiak
657fea55cb [2.2.x] Skipped GetImageDimensionsTests.test_webp when WEBP is not installed.
Bumped minimum Pillow version to 4.2.0 in test requirements.

Backport of fce389af7cf95151118c9fc7cafd777a31f94946 from master
2020-10-06 11:32:34 +02:00
Mariusz Felisiak
a3aebfdc81 [2.2.x] Fixed CVE-2020-24584 -- Fixed permission escalation in intermediate-level directories of the file system cache on Python 3.7+.
Backport of f56b57976133129b0b351a38bba4ac882badabf0 from master.
2020-08-25 11:09:40 +02:00
Mariusz Felisiak
375657a71c [2.2.x] Fixed CVE-2020-24583, #31921 -- Fixed permissions on intermediate-level static and storage directories on Python 3.7+.
Thanks WhiteSage for the report.

Backport of ea0febbba531a3ecc8c77b570efbfb68ca7155db from master.
2020-08-25 10:59:42 +02:00
Gert Burger
0a7d321bf7 [2.2.x] Fixed #31863 -- Prevented mutating model state by copies of model instances.
Regression in bfb746f983aa741afa3709794e70f1e0ab6040b5.

Backport of 94ea79be137f3cb30949bf82198e96e094f2650d from master
2020-08-13 15:28:21 +02:00
Daniel Hillier
839f906a23 [2.2.x] Fixed #31866 -- Fixed locking proxy models in QuerySet.select_for_update(of=()).
Backport of 60626162f76f26d32a38d18151700cb041201fb3 from master
2020-08-11 12:33:18 +02:00
Mariusz Felisiak
d74e1c0521
[2.2.x] Pinned geoip2 < 4.0.0 in test requirements.
geoip2 4+ doesn't support Python 3.5.
2020-07-23 10:07:35 +02:00
Mariusz Felisiak
eb81593875 [2.2.x] Fixed #31805 -- Fixed SchemaTests.tearDown() when table names are case-insensitive.
Backport of fd53db842c35c994dbd54196dd38a908f3676b1a from master
2020-07-22 12:52:45 +02:00
Florian Apolloner
1a3835fdf3 [2.2.x] Fixed #31784 -- Fixed crash when sending emails on Python 3.6.11+, 3.7.8+, and 3.8.4+.
Fixed sending emails crash on email addresses with display names longer
then 75 chars on Python 3.6.11+, 3.7.8+, and 3.8.4+.

Wrapped display names were passed to email.headerregistry.Address()
what caused raising an exception because address parts cannot contain
CR or LF.

See https://bugs.python.org/issue39073

Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>

Backport of 96a3ea39ef0790dbc413dde0a3e19f6a769356a2 from master.
2020-07-20 08:11:30 +02:00
Mariusz Felisiak
f1a6e6c817 [2.2.x] Fixed #31790 -- Fixed setting SameSite cookies flag in HttpResponse.delete_cookie().
Cookies with the "SameSite" flag set to None and without the "secure"
flag will be soon rejected by latest browser versions.

This affects sessions and messages cookies.

Backport of 331324ecce1330dce3dbd1713203cb9a42854ad7 from stable/3.0.x
2020-07-16 09:35:35 +02:00
Mariusz Felisiak
5968a23e15
[2.2.x] Fixed ForeignKeyRawIdWidgetTest.test_render_unsafe_limit_choices_to on Python 3.5. 2020-07-02 10:59:15 +02:00
Mariusz Felisiak
fc2a3682f6
[2.2.x] Refs #31751 -- Doc'd that cx_Oracle < 8 is required. 2020-06-30 09:47:50 +02:00
Stephen Rauch
cdad78e6ee [2.2.x] Refs #30183 -- Doc'd dropping support for sqlparse < 0.2.2.
Support for sqlparse < 0.2.2 was broken in
782d85b6dfa191e67c0f1d572641d8236c79174c because is_whitespace property
was added in sqlparse 0.2.2.

Backport of 4b6db766ba4b613d317c87f87d1d63865b7424a4 from master.
2020-06-10 06:18:44 +02:00
Mariusz Felisiak
b2b2723512 [2.2.x] Fixed #31654 -- Fixed cache key validation messages.
Backport of 926148ef019abcac3a9988c78734d9336d69f24e from master.
2020-06-05 07:24:04 +02:00
Mariusz Felisiak
b87719034a
[2.2.x] Fixed ForeignKeyRawIdWidgetTest.test_render_unsafe_limit_choices_to on Python 3.5. 2020-06-04 07:37:40 +02:00
Mariusz Felisiak
ea9bc392c4 [2.2.x] Refs CVE-2020-13254 -- Fixed cache.tests when KEY_PREFIX is defined.
Follow up to 2c82414914ae6476be5a166be9ff49c24d0d9069.

Backport of 229c9c6653356a0bc23846d83b2d4b5d0438a145 from master
2020-06-03 13:01:31 +02:00
Dan Palmer
07e59caa02 [2.2.x] Fixed CVE-2020-13254 -- Enforced cache key validation in memcached backends. 2020-06-03 09:34:29 +02:00
Jon Dufresne
6d61860b22 [2.0.x] Fixed CVE-2020-13596 -- Fixed potential XSS in admin ForeignKeyRawIdWidget. 2020-06-03 09:33:38 +02:00
Mariusz Felisiak
8301bc9cfa [2.2.x] Fixed E128, E741 flake8 warnings.
Backport of 0668164b4ac93a5be79f5b87fae83c657124d9ab from master.
2020-06-02 11:04:23 +02:00
Carlton Gibson
027840d7de [2.2.x] Fixed #31570 -- Corrected translation loading for apps providing territorial language variants with different plural equations.
Regression in e3e48b00127c09eafe6439d980a82fc5c591b673.

Thanks to Shai Berger for report, reproduce and suggested fix.

Backport of dd1ca50b096bf0351819aabc862e91a9797ddaca from master.
2020-06-01 09:29:03 +02:00
Mariusz Felisiak
e33220ffd8 [2.2.x] Fixed LiveWidgetTests.test_textarea_trailing_newlines() crash on Chrome 75+.
Backport of b08a18f17ba53eb0bc7fd7993924f3d7f8ed5c52 from master
2020-05-29 09:51:42 +02:00
Claude Paroz
996be04c3c [2.2.x] Fixed #30439 -- Added support for different plural forms for a language.
Thanks to Michal Čihař for review.
Backport of e3e48b00127c09eafe6439d980a82fc5c591b673 from master
2020-03-10 16:04:58 +01:00
Mariusz Felisiak
3acffe1420 [2.2.x] Fixed GeoQuerySetTest.test_unionagg_tolerance() test on Oracle 18c.
Backport of 5ca76baa729bbbe62f5c4a0fc4f89747dc999029 from master
2020-03-05 08:56:56 +01:00
Mariusz Felisiak
fe886a3b58 [2.2.x] Fixed CVE-2020-9402 -- Properly escaped tolerance parameter in GIS functions and aggregates on Oracle.
Thanks to Norbert Szetei for the report.
2020-03-04 09:34:39 +01:00
Abhijeet Viswa
32d89bf114 [2.2.x] Fixed #31246 -- Fixed locking models in QuerySet.select_for_update(of=()) for related fields and parent link fields with multi-table inheritance.
Partly regression in 0107e3d1058f653f66032f7fd3a0bd61e96bf782.

Backport of 1712a76b9dfda1ef220395e62ea87079da8c9f6c from master.
2020-02-11 21:37:17 +01:00
Simon Charette
c67a368c16 [2.2.x] Fixed CVE-2020-7471 -- Properly escaped StringAgg(delimiter) parameter. 2020-01-26 18:51:25 +01:00
Mariusz Felisiak
96d6443121 [2.2.x] Fixed timezones tests for PyYAML 5.3+.
Backport of 8be477be5c1a4afc9ad00bb58a324f637e018c0f from master
2020-01-07 09:55:41 +01:00
Simon Charette
4d334bea06 [2.2.x] Fixed CVE-2019-19844 -- Used verified user email for password reset requests.
Backport of 5b1fbcef7a8bec991ebe7b2a18b5d5a95d72cb70 from master.

Co-Authored-By: Florian Apolloner <florian@apolloner.eu>
2019-12-18 09:16:08 +01:00
Peter Andersen
f33be1e8ae [2.2.x] Fixed #31073 -- Prevented CheckboxInput.get_context() from mutating attrs.
Backport of 02eff7ef60466da108b1a33f1e4dc01eec45c99d from master
2019-12-11 09:38:49 +01:00
Carlton Gibson
36f580a17f Fixed CVE-2019-19118 -- Required edit permissions on parent model for editable inlines in admin.
Thank you to Shen Ying for reporting this issue.
2019-12-02 08:58:14 +01:00
Mariusz Felisiak
6cf3b6f5cf [2.2.x] Fixed #30953 -- Made select_for_update() lock queryset's model when using "self" with multi-table inheritance.
Thanks Abhijeet Viswa for the report and initial patch.
Backport of 0107e3d1058f653f66032f7fd3a0bd61e96bf782 from master
2019-12-02 07:58:44 +01:00
Mariusz Felisiak
9a17ae50c6 [2.2.x] Fixed #31021 -- Fixed proxy model permissions data migration crash with a multiple databases setup.
Regression in 98296f86b340c8c9c968375d59f1d3a3479e60c2.

Backport of e8fcdaad5c428878d0a5d6ba820d957013f75595 from master
2019-11-29 11:10:59 +01:00
Baptiste Mispelon
7873d3757d [2.2.x] Fixed #31031 -- Fixed data loss in admin changelist view when formset's prefix contains regex special chars.
Regression in b18650a2634890aa758abae2f33875daa13a9ba3.

Backport of 52936efacec4df05df2d9872c09c3332335bf21b from master
2019-11-26 09:19:39 +01:00
Mariusz Felisiak
8eda248dc9 [2.2.x] Refs #29926 -- Bumped minimum tblib version to 1.5.0 in test requirements.
Backport of 25903e41fb45ce9cc80dc93bf4b51ea431dcb2b6 from master.
2019-11-12 21:49:09 +01:00
Carlton Gibson
785d1706c4 [2.2.x] Fixed #30931 -- Restored ability to override Model.get_FIELD_display().
Thanks Sergey Fedoseev for the implementation idea.

Regression in a68ea231012434b522ce45c513d84add516afa60.

Backport of 2d38eb0ab9f78d68c083a5b78b1eca39027b279a from master
2019-11-04 08:17:50 +01:00
Hannes Ljungberg
7fe09e6d41 [2.2.x] Fixed #30903 -- Fixed migrations crash on PostgreSQL when adding Index with opclasses and ordering.
Backport of fa5f3291e7f2611d53e64ab481ebe951b0161791 from master
2019-10-24 09:53:33 +02:00