Skip to content

Commit b24a2d8

Browse files
committed
INTPYTHON-451 Remove support for database caching
This reverts commit 64b1c10.
1 parent c7831c6 commit b24a2d8

File tree

16 files changed

+17
-1381
lines changed

16 files changed

+17
-1381
lines changed

django_mongodb_backend/cache.py

Lines changed: 0 additions & 216 deletions
This file was deleted.

django_mongodb_backend/creation.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
from django.conf import settings
22
from django.db.backends.base.creation import BaseDatabaseCreation
33

4-
from django_mongodb_backend.management.commands.createcachecollection import (
5-
Command as CreateCacheCollection,
6-
)
7-
84

95
class DatabaseCreation(BaseDatabaseCreation):
106
def _execute_create_test_db(self, cursor, parameters, keepdb=False):
@@ -24,15 +20,6 @@ def _destroy_test_db(self, test_database_name, verbosity):
2420
if not collection.startswith("system."):
2521
self.connection.database.drop_collection(collection)
2622

27-
def create_test_db(self, *args, **kwargs):
28-
test_database_name = super().create_test_db(*args, **kwargs)
29-
# Not using call_command() avoids the requirement to put
30-
# "django_mongodb_backend" in INSTALLED_APPS.
31-
CreateCacheCollection().handle(
32-
database=self.connection.alias, verbosity=kwargs["verbosity"]
33-
)
34-
return test_database_name
35-
3623
def destroy_test_db(self, old_database_name=None, verbosity=1, keepdb=False, suffix=None):
3724
super().destroy_test_db(old_database_name, verbosity, keepdb, suffix)
3825
# Close the connection to the test database.

django_mongodb_backend/management/__init__.py

Whitespace-only changes.

django_mongodb_backend/management/commands/__init__.py

Whitespace-only changes.

django_mongodb_backend/management/commands/createcachecollection.py

Lines changed: 0 additions & 50 deletions
This file was deleted.

docs/source/index.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,6 @@ Forms
5151

5252
- :doc:`ref/forms`
5353

54-
Core functionalities
55-
====================
56-
57-
- :doc:`topics/cache`
58-
5954
Miscellaneous
6055
=============
6156

docs/source/ref/django-admin.rst

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,3 @@ in the :setting:`INSTALLED_APPS` setting.
1313

1414
Available commands
1515
==================
16-
17-
``createcachecollection``
18-
-------------------------
19-
20-
.. django-admin:: createcachecollection
21-
22-
Creates the cache collection for use with the :doc:`database cache backend
23-
</topics/cache>` using the information from your :setting:`CACHES` setting.
24-
25-
.. django-admin-option:: --database DATABASE
26-
27-
Specifies the database in which the cache collection(s) will be created.
28-
Defaults to ``default``.

docs/source/releases/5.1.x.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ Django MongoDB Backend 5.1.x
77

88
*Unreleased*
99

10+
- Backward-incompatible: Removed support for database caching as the MongoDB security
11+
team considers the cache backend's ``pickle`` encoding of cached values a
12+
vulnerability. If an attacker compromises the database, they could run arbitrary
13+
commands on the application server.
1014
- Fixed crash when loading models with a null value for ``ArrayField``\s where
1115
the ``base_field`` uses a database converter.
1216
- Fixed ``RecursionError`` when using ``Trunc`` database functions on non-MongoDB
@@ -39,7 +43,7 @@ Django MongoDB Backend 5.1.x
3943
:attr:`~.ArrayField.size` parameter is renamed to
4044
:attr:`~.ArrayField.max_size`. The :attr:`~.ArrayField.size` parameter is now
4145
used to enforce fixed-length arrays.
42-
- Added support for :doc:`database caching </topics/cache>`.
46+
- Added support for database caching (later removed in beta 4).
4347
- Fixed ``QuerySet.raw_aggregate()`` field initialization when the document key
4448
order doesn't match the order of the model's fields.
4549

docs/source/releases/5.2.x.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ New features
1818
:class:`~.fields.PolymorphicEmbeddedModelArrayField` for storing a model
1919
instance or list of model instances that may be of more than one model class.
2020

21+
Backwards incompatible changes
22+
------------------------------
23+
24+
- Removed support for database caching as the MongoDB security team considers the cache
25+
backend's ``pickle`` encoding of cached values a vulnerability. If an attacker
26+
compromises the database, they could run arbitrary commands on the application
27+
server.
28+
2129
Bug fixes
2230
---------
2331

0 commit comments

Comments
 (0)