diff options
| author | Dennis Fink | 2026-10-31 16:42:44 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-10-31 16:42:44 +0100 |
| commit | 3494eab1208dc18478485e02c61e292556502fa6 (patch) | |
| tree | 5d9e95d709b119a0245d0294837f9b6a7e38bff1 /webmentions_ssg/config.py | |
| parent | fdb1762715658eae987dd104a0e6d3cb92a4a8d7 (diff) | |
| download | webmentions-ssg-3494eab1208dc18478485e02c61e292556502fa6.tar.gz webmentions-ssg-3494eab1208dc18478485e02c61e292556502fa6.zip | |
fix(core): harden session and credential security
Require persistent non-placeholder signing keys outside local
development and bind login sessions to the current password hash so
password changes revoke existing cookies.
Enforce a minimal password policy for user administration while
preserving long Unicode passphrases without arbitrary composition
limits.
Diffstat (limited to '')
| -rw-r--r-- | webmentions_ssg/config.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/webmentions_ssg/config.py b/webmentions_ssg/config.py index 1c7d44e..28cea64 100644 --- a/webmentions_ssg/config.py +++ b/webmentions_ssg/config.py @@ -5,7 +5,6 @@ """Define application settings for production, development, and testing.""" import logging -import secrets def normalize_allowed_hostnames(value: object) -> set[str]: @@ -26,7 +25,8 @@ def normalize_allowed_hostnames(value: object) -> set[str]: class DefaultConfig: TESTING = False DEBUG = False - SECRET_KEY = secrets.token_urlsafe() + # Production must provide a persistent, random key through configuration. + SECRET_KEY = None BOOTSTRAP_SERVE_LOCAL = True # BOOTSTRAP_BOOTSWATCH_THEME = "Materia" # Secure by default; deployment configuration can override these values. @@ -82,6 +82,8 @@ class DefaultConfig: class DevelopmentConfig(DefaultConfig): DEBUG = True + # Only for local debug use; production rejects this as an insecure value. + SECRET_KEY = "INSECURE_DEVELOPMENT_ONLY_SECRET_KEY" SESSION_COOKIE_SECURE = False LOG_FILE = "testing/webmentions-ssg.log" LOG_LEVEL = logging.DEBUG |
