porchlight/tests/test_auth_routes
Johan Lundberg baef5e0e2e
fix(security): require CSRF-protected POST to consume a registration link
GET /register/{token} consumed the magic-link token and created a session, so
a side-effecting state change happened on a safe method — link prefetchers,
email scanners, or a cross-site GET could trigger account setup/login.

Split the flow: GET validates the token (without consuming) and renders a
confirmation form; POST /register/{token} consumes the token, runs the
existing checks, and establishes the session. The POST carries a CSRF token
and the session is reset on login as for other auth paths.

Refs: porchlight-9k0

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-05 13:40:30 +02:00
..
__init__.py feat: add authentication routes with session login, WebAuthn, and credential management 2026-02-16 11:39:50 +01:00
test_last_credential_guard.py fix: reorder imports and use ty-compatible type suppression 2026-02-19 14:29:01 +01:00
test_login_session.py fix(security): reset session on login to prevent fixation 2026-06-04 14:23:08 +02:00
test_manage_credentials_page.py fix: reorder imports and use ty-compatible type suppression 2026-02-19 14:29:01 +01:00
test_manage_password_credential.py feat: require current password when changing password, add zxcvbn strength check 2026-03-31 15:34:43 +02:00
test_manage_webauthn_credential.py fix: reorder imports and use ty-compatible type suppression 2026-02-19 14:29:01 +01:00
test_pages.py feat: add authentication routes with session login, WebAuthn, and credential management 2026-02-16 11:39:50 +01:00
test_password_login.py fix: reorder imports and use ty-compatible type suppression 2026-02-19 14:29:01 +01:00
test_register_magic_link.py fix(security): require CSRF-protected POST to consume a registration link 2026-06-05 13:40:30 +02:00
test_session_deps.py update all imports in test files: fastapi_oidc_op → porchlight 2026-02-16 15:34:53 +01:00
test_webauthn_login.py fix: reorder imports and use ty-compatible type suppression 2026-02-19 14:29:01 +01:00