remove dzen basic auth gate

This commit is contained in:
nstarikov 2026-08-11 13:11:24 +03:00
parent b7141df7e5
commit 44d5bf37e9
2 changed files with 5 additions and 10 deletions

View file

@ -537,11 +537,6 @@ dzen.nstarikov.ru {
import snippet_block_bots import snippet_block_bots
import snippet_security_headers import snippet_security_headers
@admin path /admin* /api*
basic_auth @admin {
admin $2a$14$P4L2AQE5GrhdJ9UWy2sNHuRryJarO3pReiGVVs3VGe/hX.ObQaqbO
}
handle { handle {
reverse_proxy dzen-assistant-api:8000 reverse_proxy dzen-assistant-api:8000
} }

View file

@ -2,9 +2,9 @@
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Replace repeated Basic Auth prompts on `dzen.nstarikov.ru` with Face ID, Touch ID, Windows Hello, or another WebAuthn passkey while retaining a guarded emergency Basic Auth path. **Goal:** Replace repeated Basic Auth prompts on `dzen.nstarikov.ru` with VK ID for the allowlisted VK user and Face ID, Touch ID, Windows Hello, or another WebAuthn passkey.
**Architecture:** FastAPI will own authentication for `/admin` and `/api`: public WebAuthn challenge endpoints issue registration and authentication options, verification creates an HttpOnly session cookie, and a middleware protects all other admin/API routes. SQLite stores passkey credentials and sessions. Caddy will stop applying Basic Auth to the main host; the existing Basic Auth configuration remains available on a separate emergency host until passkey login is verified. **Architecture:** FastAPI will own authentication for `/admin` and `/api`: VK ID bootstrap is restricted to `vk_user_id=32018`, WebAuthn challenge endpoints issue registration and authentication options, verification creates an HttpOnly session cookie, and middleware protects all other admin/API routes. SQLite stores passkey credentials and sessions. Caddy no longer applies Basic Auth to the main host.
**Tech Stack:** FastAPI, SQLAlchemy/SQLite, `webauthn` Python package, browser WebAuthn API, React/Vite, Caddy. **Tech Stack:** FastAPI, SQLAlchemy/SQLite, `webauthn` Python package, browser WebAuthn API, React/Vite, Caddy.
@ -32,7 +32,7 @@
- [ ] Add registration options/verification and authentication options/verification using `generate_*_options`, `verify_*_response`, and JSON helpers from `webauthn`. - [ ] Add registration options/verification and authentication options/verification using `generate_*_options`, `verify_*_response`, and JSON helpers from `webauthn`.
- [ ] Set and clear Secure, HttpOnly, SameSite=Lax session cookies. - [ ] Set and clear Secure, HttpOnly, SameSite=Lax session cookies.
- [ ] Permit only auth bootstrap/challenge/verify/health without a session; require a session for `/admin`, `/api`, and logs WebSockets. - [ ] Permit only auth bootstrap/challenge/verify/health without a session; require a session for `/admin`, `/api`, and logs WebSockets.
- [ ] Keep first-device registration guarded by the existing Basic Auth during migration. - [ ] Keep first-device registration guarded by an authenticated VK ID session.
### Task 3: Add passkey UI ### Task 3: Add passkey UI
@ -51,7 +51,7 @@
- Modify: `Caddyfile.server` - Modify: `Caddyfile.server`
- Modify: `Caddyfile.snippet` if needed - Modify: `Caddyfile.snippet` if needed
- [ ] Remove Basic Auth from the main `dzen.nstarikov.ru` route while keeping an emergency host/path protected by Basic Auth. - [ ] Remove Basic Auth from the main `dzen.nstarikov.ru` route.
- [ ] Validate Caddy configuration, deploy API/admin/Caddy changes, and verify HTTPS origin and cookie behavior. - [ ] Validate Caddy configuration, deploy API/admin/Caddy changes, and verify HTTPS origin and cookie behavior.
- [ ] Test registration and login on iPhone Safari/PWA and a desktop platform authenticator. - [ ] Test registration and login on iPhone Safari/PWA and a desktop platform authenticator.
@ -59,4 +59,4 @@
- [ ] Run `python3 -m py_compile app/*.py` and `npm --prefix admin run build`. - [ ] Run `python3 -m py_compile app/*.py` and `npm --prefix admin run build`.
- [ ] Verify unauthenticated API returns `401`, authenticated API returns `200`, `/feed` remains public, and WebSocket logs accept the session cookie. - [ ] Verify unauthenticated API returns `401`, authenticated API returns `200`, `/feed` remains public, and WebSocket logs accept the session cookie.
- [ ] Verify the emergency Basic Auth path remains reachable before removing any old credential mechanism. - [ ] Verify the VK allowlist and passkey session boundary; no Basic Auth fallback remains on the main host.