Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
settings: Add new SIGNED_ACCESS_TOKEN_VALIDITY_IN_SECONDS setting.
Mateusz Mandera2149cd236f42
diff --git a/zerver/views/upload.py b/zerver/views/upload.pyindex 9c01f343be1..069c88e2e37 100644--- a/zerver/views/upload.py+++ b/zerver/views/upload.py@@ -208,7 +208,9 @@ def get_file_path_id_from_token(token: str) -> Optional[str]:signer = TimestampSigner(salt=USER_UPLOADS_ACCESS_TOKEN_SALT)try:signed_data = base64.b16decode(token).decode()- path_id = signer.unsign(signed_data, max_age=timedelta(seconds=60))+ path_id = signer.unsign(+ signed_data, max_age=timedelta(seconds=settings.SIGNED_ACCESS_TOKEN_VALIDITY_IN_SECONDS)+ )except (BadSignature, binascii.Error):return Nonediff --git a/zproject/default_settings.py b/zproject/default_settings.pyindex d54a841eed9..d935bc56398 100644--- a/zproject/default_settings.py+++ b/zproject/default_settings.py@@ -608,3 +608,7 @@ MAX_STREAM_SIZE_FOR_TYPING_NOTIFICATIONS = 100# installations with thousands of users with many guests limited in# this way, pending further optimization of the relevant code paths.CAN_ACCESS_ALL_USERS_GROUP_LIMITS_PRESENCE = False++# General expiry time for signed tokens we may generate+# in some places through the codebase.+SIGNED_ACCESS_TOKEN_VALIDITY_IN_SECONDS = 60