You've already forked Mailu
mirror of
https://github.com/Mailu/Mailu.git
synced 2025-11-29 22:37:58 +02:00
Merge #1783
1783: Switch to server-side sessions r=mergify[bot] a=nextgens ## What type of PR? bug-fix ## What does this PR do? It simplifies session management. - it ensures that sessions will eventually expire (*) - it implements some mitigation against session-fixation attacks - it switches from client-side to server-side sessions (in Redis) It doesn't prevent us from (re)-implementing a "remember_me" type of feature if that's considered useful by some. Co-authored-by: Florent Daigniere <nextgens@freenetproject.org>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import os
|
||||
|
||||
from datetime import timedelta
|
||||
from socrate import system
|
||||
|
||||
DEFAULT_CONFIG = {
|
||||
@@ -54,6 +55,7 @@ DEFAULT_CONFIG = {
|
||||
'RECAPTCHA_PRIVATE_KEY': '',
|
||||
# Advanced settings
|
||||
'LOG_LEVEL': 'WARNING',
|
||||
'SESSION_LIFETIME': 24,
|
||||
'SESSION_COOKIE_SECURE': True,
|
||||
'CREDENTIAL_ROUNDS': 12,
|
||||
# Host settings
|
||||
@@ -136,6 +138,8 @@ class ConfigManager(dict):
|
||||
self.config['QUOTA_STORAGE_URL'] = 'redis://{0}/1'.format(self.config['REDIS_ADDRESS'])
|
||||
self.config['SESSION_COOKIE_SAMESITE'] = 'Strict'
|
||||
self.config['SESSION_COOKIE_HTTPONLY'] = True
|
||||
self.config['SESSION_KEY_BITS'] = 128
|
||||
self.config['PERMANENT_SESSION_LIFETIME'] = timedelta(hours=int(self.config['SESSION_LIFETIME']))
|
||||
# update the app config itself
|
||||
app.config = self
|
||||
|
||||
|
||||
Reference in New Issue
Block a user