mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #30360 -- Added support for secret key rotation.
Thanks Florian Apolloner for the implementation idea. Co-authored-by: Andreas Pelme <andreas@pelme.se> Co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es> Co-authored-by: Vuyisile Ndlovu <terrameijar@gmail.com>
This commit is contained in:
parent
ba4a6880d1
commit
0dcd549bbe
18 changed files with 364 additions and 56 deletions
|
@ -59,6 +59,22 @@ or from a file::
|
|||
with open('/etc/secret_key.txt') as f:
|
||||
SECRET_KEY = f.read().strip()
|
||||
|
||||
If rotating secret keys, you may use :setting:`SECRET_KEY_FALLBACKS`::
|
||||
|
||||
import os
|
||||
SECRET_KEY = os.environ['CURRENT_SECRET_KEY']
|
||||
SECRET_KEY_FALLBACKS = [
|
||||
os.environ['OLD_SECRET_KEY'],
|
||||
]
|
||||
|
||||
Ensure that old secret keys are removed from ``SECRET_KEY_FALLBACKS`` in a
|
||||
timely manner.
|
||||
|
||||
.. versionchanged:: 4.1
|
||||
|
||||
The ``SECRET_KEY_FALLBACKS`` setting was added to support rotating secret
|
||||
keys.
|
||||
|
||||
:setting:`DEBUG`
|
||||
----------------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue