feat(auth): use central application handoff - #17
Conversation
TLDR\n\nReplace Explorer's duplicated local password system with the central Auth authorization-code flow. Explorer keeps its Elcano integration and now owns only its deployment-specific access list and revocable application sessions. Motivation\n\nMaintaining passwords independently in every client application creates inconsistent security behavior and additional accounts for users. Explorer should delegate authentication while still deciding which authenticated emails may access each deployment. Fix\n\n- Add a central Auth client with exact callback, state, nonce, S256 PKCE, confidential token exchange, redirect refusal, and bounded responses.\n- Add a SQLite email access list plus hashed opaque Explorer sessions with idle and absolute expiry, CSRF logout, and immediate revocation.\n- Remove the temporary Explorer-local password implementation and Argon2 dependency.\n- Preserve the legacy Elcano external-cookie provider as the default mode.\n- Add access-list CLI commands, bootstrap/update plumbing, deployment documentation, and a signed-out page. Tests\n\n- 87 passed: .venv/bin/python -m pytest -q\n- Ruff check passed and 16 files formatted\n- bash -n and shellcheck passed for deployment scripts\n- git diff --cached --check\n- gitleaks staged scan: no leaks
|
Review pass (second reviewer). Verdict: sound and compatible with ElcanoTek/auth#20. State and nonce are 256-bit and single-use, PKCE S256 with an 86-character verifier, exact callback from the configured public origin, Basic client auth with the client id echoed in the form, redirect refusal and a bounded body on the token response, transaction popped before exchange, app session hashed at rest with idle and absolute limits, access list is default-deny, Pushed one follow-up commit with low-risk hardening: the token response is now checked for For the owner (also in the brain vault):
|
…; tell users to retry a rejected code (#18) TL;DR: Review follow-ups on the central-auth client (#17). The token response is checked for iss, aud and exp (60s skew); a 400 from the token endpoint maps to "Sign-in expired. Try again." instead of a 502; state and nonce compares operate on bytes so non-ASCII input cannot raise; bootstrap writes .env owner-only. 98 tests, ruff, shellcheck, CodeQL clean.
TLDR
Replaces Explorer's duplicated local password implementation with the central Auth authorization-code flow. Explorer preserves the existing Elcano provider and now owns only its deployment-local email allowlist and revocable application sessions.
Motivation
Running a separate password database in every Explorer, Lens, and Pages deployment would multiply credentials and security implementations. Authentication should be central while each application independently decides which authenticated client users it admits.
Fix
Tests
Checklist
Screenshots
Not included. This removes the local login/password pages; the only new page is the small signed-out handoff page, while redirects, cookies, callbacks, allowlist denial, and logout behavior are covered by endpoint tests.