maint: Dependency upgrades and High backlog items (v2.11.0)
- All dependencies to current releases (97 known vulnerabilities -> 0), Python 3.14, uv pinned, requirements-test.txt, lxml/dateutil pinned - CSRF tokens on admin forms, logout and IndieAuth consent - IndieAuth client and crosspost link-card fetches via safe_get - FLASK_DEBUG/FLASK_ENV default off/production; image sets them - Foreign keys enforced on pooled connections; migration 018 removes orphans - Rate limits shared across processes (rate_limits, migration 019) - datetime.utcnow() and sqlite3 default adapters replaced - compose.yaml fixed; duplicate dev_auth.py and test.ini removed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9f17e145ff
commit
75946be7b2
67 files changed
+885
-498
No files matched your search
+6
-6
@@ -4,7 +4,7 @@ Tests for authentication module (starpunk/auth.py)
|
||||
|
||||
import hashlib
|
||||
import secrets
|
||||
from datetime import datetime, timedelta
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import httpx
|
||||
@@ -102,7 +102,7 @@ class TestCleanup:
|
||||
with app.app_context():
|
||||
# Create expired session
|
||||
token_hash = _hash_token("expired-token")
|
||||
expires_at = datetime.utcnow() - timedelta(days=1)
|
||||
expires_at = datetime.now(timezone.utc).replace(tzinfo=None) - timedelta(days=1)
|
||||
|
||||
db.execute(
|
||||
"""
|
||||
@@ -126,7 +126,7 @@ class TestCleanup:
|
||||
"""Test that cleanup keeps valid sessions"""
|
||||
with app.app_context():
|
||||
token_hash = _hash_token("valid-token")
|
||||
expires_at = datetime.utcnow() + timedelta(days=30)
|
||||
expires_at = datetime.now(timezone.utc).replace(tzinfo=None) + timedelta(days=30)
|
||||
|
||||
db.execute(
|
||||
"""
|
||||
@@ -226,7 +226,7 @@ class TestVerifySession:
|
||||
# Create expired session
|
||||
token = secrets.token_urlsafe(32)
|
||||
token_hash = _hash_token(token)
|
||||
expires_at = datetime.utcnow() - timedelta(days=1)
|
||||
expires_at = datetime.now(timezone.utc).replace(tzinfo=None) - timedelta(days=1)
|
||||
|
||||
db.execute(
|
||||
"""
|
||||
@@ -340,7 +340,7 @@ class TestRequireAuthDecorator:
|
||||
with app.app_context():
|
||||
token = secrets.token_urlsafe(32)
|
||||
token_hash = _hash_token(token)
|
||||
expires_at = datetime.utcnow() - timedelta(days=1)
|
||||
expires_at = datetime.now(timezone.utc).replace(tzinfo=None) - timedelta(days=1)
|
||||
|
||||
db.execute(
|
||||
"""
|
||||
@@ -397,7 +397,7 @@ class TestSecurityFeatures:
|
||||
).fetchone()
|
||||
|
||||
expires_at = datetime.fromisoformat(result["expires_at"])
|
||||
created_at = datetime.utcnow()
|
||||
created_at = datetime.now(timezone.utc).replace(tzinfo=None)
|
||||
|
||||
# Should expire approximately 1 day from now
|
||||
# (allow for minor timing differences)
|
||||
|
||||
Reference in new issue
Block a user