1
0
mirror of https://github.com/django/django.git synced 2025-02-28 11:34:28 +00:00

[4.2.x] Doc'd use of asgiref.sync adapters with sensitive variables.

Backport of 6087bc4e15e89d968396807f8485f4b5624c4f03 from main.
This commit is contained in:
Carlton Gibson 2023-03-22 12:32:13 +01:00
parent e4fad1372d
commit d118cbb1ed
2 changed files with 25 additions and 0 deletions

View File

@ -194,6 +194,17 @@ filtered out of error reports in a production environment (that is, where
def process_info(user):
...
.. warning::
Due to the machinery needed to cross the sync/async boundary,
:func:`~asgiref.sync.sync_to_async` and
:func:`~asgiref.sync.async_to_sync` are **not** compatible with
``sensitive_variables()``.
If using these adapters with sensitive variables, ensure to audit
exception reporting, and consider implementing a :ref:`custom filter
<custom-error-reports>` if necessary.
.. function:: sensitive_post_parameters(*parameters)
If one of your views receives an :class:`~django.http.HttpRequest` object

View File

@ -338,3 +338,17 @@ trigger the thread safety checks:
Rather, you should encapsulate all database access within a helper function
that can be called with ``sync_to_async()`` without relying on the connection
object in the calling code.
Use with exception reporting filters
------------------------------------
.. warning::
Due to the machinery needed to cross the sync/async boundary,
``sync_to_async()`` and ``async_to_sync()`` are **not** compatible with
:func:`~django.views.decorators.debug.sensitive_variables`, used to mask
local variables from exception reports.
If using these adapters with sensitive variables, ensure to audit exception
reporting, and consider implementing a :ref:`custom filter
<custom-error-reports>` if necessary.