fix: v0.5.1 - Fernet key setup fuer EncryptedCookieStorage korrigiert

Fernet-Objekt direkt an EncryptedCookieStorage uebergeben statt
bytes (die intern nochmal base64-encoded wurden).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
ppfeiffer 2026-02-16 19:44:53 +01:00
parent 0d6b26f4f8
commit 49e8b409bd
3 changed files with 8 additions and 3 deletions

View file

@ -1,5 +1,9 @@
# Changelog
## [0.5.1] - 2026-02-16
### Fixed
- Fernet key setup fuer EncryptedCookieStorage korrigiert (doppelte Base64-Kodierung)
## [0.5.0] - 2026-02-16
### Added
- Benutzerverwaltung mit Session-basierter Authentifizierung

View file

@ -1,4 +1,4 @@
version: "0.5.0"
version: "0.5.1"
bot:
name: "MeshDD-Bot"

View file

@ -28,8 +28,9 @@ def check_password(password: str, hashed: str) -> bool:
def setup_session(app: web.Application):
secret_key = config.get("auth.secret_key", "change-this-secret-key-32bytes!!")
# Fernet requires a 32-byte url-safe base64-encoded key
fernet_key = base64.urlsafe_b64encode(secret_key.encode("utf-8")[:32])
# EncryptedCookieStorage accepts a Fernet object directly
key_bytes = secret_key.encode("utf-8")[:32].ljust(32, b"\0")
fernet_key = Fernet(base64.urlsafe_b64encode(key_bytes))
max_age = config.get("auth.session_max_age", 86400)
storage = EncryptedCookieStorage(
fernet_key,