porchlight/tests/test_auth_routes
Johan Lundberg c175633980
fix(security): POST WebAuthn login-begin; render JS errors as text
Two WebAuthn client/route hardening fixes:

- GET /login/webauthn/begin wrote a challenge to the session on a safe method
  (login-flow DoS / CSRF surface). Make it POST with CSRF, matching the
  registration-begin endpoint; update webauthn.js and tests accordingly.

- webauthn.js rendered dynamic error text (err.message, server error fields)
  via innerHTML — an XSS-prone sink. Add showAlert() that sets textContent;
  route all dynamic error messages through it. The trusted server-rendered
  credentials partial is still injected as markup.

Refs: porchlight-cog, porchlight-t7y

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-05 14:04:24 +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(security): POST WebAuthn login-begin; render JS errors as text 2026-06-05 14:04:24 +02:00