Commit Graph
506 Commits
Author SHA1 Message Date
LeoVasanko 80d55679fb Frontend: domain terminology, object-keyed origins, 🔑 auth host in table, display-time ordering 2026-09-07 01:31:14 +00:00
LeoVasanko 7a0737f867 Domains: object-keyed config format, drop default domain, rename realm→domain throughout backend 2026-09-07 01:25:29 +00:00
LeoVasanko dcfb497cf2 Wildcard origins + auth host configured per origin row (⋮ menu, 🔑 indicator) 2026-09-07 00:53:33 +00:00
LeoVasanko 7a9953f703 Admin UI: single origins list with automatic in-domain/ROR split + well-known check 2026-09-07 00:27:58 +00:00
LeoVasanko 7f1688e1f5 Admin UI: prefill new sign-in site with the admin's current origin on the current domain 2026-09-07 00:12:49 +00:00
LeoVasanko 38d994f312 Admin UI: rename Realms to Domains, list allowed origins per domain 2026-09-07 00:08:07 +00:00
LeoVasanko b6a1b2e4a8 Admin UI: correct auth-host help — it moves the account/admin UI, sign-in works on every site 2026-09-06 23:34:25 +00:00
LeoVasanko f5bd0a469c Best-effort serve for bad stored config + admin self-lockout guards
Serving never refuses to start because of stored realm config: the
registry build sanitizes best-effort and warns — misfiled origin entries
are reclassified (a cross-domain origins entry is served as a related
origin) or dropped, collisions resolve first-come-wins, over-cap related
lists truncate, unsalvageable realms are skipped. Fixing the stored
config stays the admin interface's job, and it stays reachable on any
working realm. Only a config with no servable realm at all is fatal.

Admin realm writes stay strict and gain self-lockout guards: an update
that would leave the admin's current host unable to run ceremonies for
the realm they are on is refused (unless an auth host takes over
ceremonies), and deleting the realm currently in use is refused.
2026-09-06 22:52:00 +00:00
LeoVasanko b9e6f4bc27 Separate related domains (ROR) from the in-domain sign-in allow-list
RealmConfig.origins is again purely an allow-list of sign-in sites
within the realm's domain (unset = rp-id and all subdomains), restoring
the restriction semantics the realm rework had silently turned into an
always-open subtree. Cross-domain ROR origins move to their own
RealmConfig.related_origins field — always additive, capped, validated
to be outside the rp-id domain, and the sole source of the
/.well-known/webauthn document.

Admin API POST/PATCH accept related_origins; misfiled entries are
rejected (cross-domain in origins, in-domain in related_origins).

Admin UI: the realm dialog edits the two lists separately with
end-user-oriented explanations (allowed sign-in sites vs. related
domains + the well-known note); the Realms section intro explains the
multi-domain model, and the table shows sign-in site and related domain
counts.
2026-09-06 22:29:12 +00:00
LeoVasanko fefd54f02a CLI: explicit 'paskia migrate' subcommand for legacy conversion
Serve never converts databases: with no paskia.kantadb it points at
'paskia init', or at 'paskia migrate' when legacy *.paskiadb candidates
exist. migrate converts a lone candidate, or the one named by --rp-id
when several exist; the rest stay in place. devserver fails fast with
the same hint. gitignore covers paskia.kantadb and *.converted-bak.
2026-09-06 22:11:17 +00:00
LeoVasanko 9b10663c10 MultiSite.md: describe only current state and design rationale
Drop all before/after contrasts, deferred ideas, and possible follow-ups
(Identity layer, per-realm remote-auth policy flag, same-device redirect
variant, legacy-module deletion note).
2026-09-06 15:55:55 +00:00
LeoVasanko 2baebc4072 Docs: multi-realm current state
README quick start and configuration updated for init/serve split and
paskia.kantadb; API.md server-config endpoints replaced with admin realm
CRUD and the well-known webauthn endpoint; proxy guides point at the
realm auth-host setting; oidc.md documents per-realm issuers; MultiSite.md
rewritten from the implementation plan into documentation of the shipped
mechanics, policy model, and design rationale.
2026-09-06 15:13:10 +00:00
LeoVasanko 8ccc257f44 E2E: two-realm setup, host dispatch, related origins, cross-realm remote login
- global-setup bootstraps via one-shot 'paskia init --rp-id
  localhost,test.localhost' in the test-data directory (which doubles as
  the server cwd, dropping the removed PASKIA_DB), captures the reset
  token from init output (stdout+stderr), then spawns plain serve.
- New 50-multirealm spec: per-host settings dispatch, 421 for unknown
  hosts, /.well-known/webauthn 404 until a related origin is added via
  the admin realm API (and removed again), and a full cross-realm remote
  login: requester on test.localhost, permit on localhost with a fresh
  virtual-authenticator passkey, session validated on test.localhost.
  Asserts the profile enrollment prompt and realm badge render.
- New fixtures/remote-auth.ts drives the remote-auth WS protocol in
  browser context, including the PBKDF2 PoW.
2026-09-06 15:06:20 +00:00
LeoVasanko e979dd6312 Devserver and proxy configs for multi-realm
- devserver bootstraps via one-shot 'paskia init' when no database
  exists (multi --rp-id, --rp-name/--auth-host/--origin apply to the
  default realm), then runs plain 'paskia' serve which reads all realm
  configuration from the database; legacy *.paskiadb is adopted by
  serve without init.
- Caddy origins iterate all bootstrap rp-ids.
- vite.config.js accepts a comma-separated PASKIA_AUTH_HOST list and
  proxies /.well-known/webauthn to the backend so ROR works in dev.
- caddy/auth/setup forwards /.well-known/openid-configuration and
  /.well-known/webauthn to paskia (they must not be swallowed by a
  static /.well-known/* file handler); Caddyfile.dev updated to match
  the generated dev config.
2026-09-06 14:49:27 +00:00
LeoVasanko 8e7acd6b9e Frontend: realm admin UI, passkey realm badges, cross-realm notices
- Admin: replace Server Options dialog with per-realm management —
  realms table on the overview, add/edit/delete realm dialog backed by
  /auth/api/admin/realms/. Origins may be any well-formed origin;
  non-subdomain ones are related origins (ROR, max 5) and the dialog
  points at the .well-known/webauthn URL that must list them.
  Connectivity checks compare against the edited realm's rp-id and
  degrade to warnings instead of blocking saves.
- Host mode (limited profile) now keys off own_auth_host so realms
  sharing another realm's auth host serve the full profile locally.
- Credential list shows a realm badge on passkeys registered for a
  different rp-id than the current realm.
- Profile shows an enrollment prompt when the user has no passkey for
  the current realm (e.g. after a cross-realm remote login).
- Remote auth permit shows the requesting realm when it differs from
  the approver's own.
- settings cache can be force-refreshed after realm changes.
2026-09-06 04:50:35 +00:00
LeoVasanko cdabc5d9e6 Realm machinery tests: resolution, validation, dispatch, code binding, conversion
- Registry resolve order (exact rp-id, auth host, related origin,
  longest suffix), port/trailing-dot normalization, unknown hosts.
- Cross-realm validate_config: related-origin cap, auth-host/related
  collisions, related-inside-other-realm, auth-host vs rp-id.
- ASGI dispatch: HTTP 421, realm in scope state, contextvar scoping and
  reset, WS pre-accept close and cross-realm effective-auth-host rule.
- Auth codes bound to issuing realm (set-session and OIDC token).
- Legacy conversion stamps credentials/sessions/OIDC with the rp-id.
- OIDC key censoring in transaction logs; bootstrap default-realm caveat.
2026-09-06 04:33:08 +00:00
LeoVasanko 33d3b88941 Test suite for the realm architecture
- conftest: bootstrap seeds a localhost realm Config; realm_registry
  fixture builds the runtime registry; avatar storage redirected to a
  per-test tmp dir; credentials/sessions stamped with the test realm.
- test_cli rewritten for the init/serve split, incl. legacy adoption.
- TestServerConfig replaced by TestRealms covering the realm CRUD API,
  cross-realm validation, delete guards and effective-auth-host fallback.
- Avatar/OIDC tests updated for per-realm providers and realm-derived
  URLs; obsolete PASKIA_DB path tests removed.
2026-09-06 04:28:35 +00:00
LeoVasanko f44bcc9dea Realm dispatch, per-realm OIDC, realm-scoped credentials and admin realm API
- DispatchMiddleware (outermost app middleware) resolves Host to a realm:
  HTTP 421 for unknown hosts, WS closed pre-accept (1008); cross-realm WS
  only via the origin realm's effective auth host. Current realm exposed
  via request.state.realm and the current_realm() contextvar.
- Credentials and sessions are scoped by realm rp_id: authentication only
  matches credentials of the dispatched realm; sessions record rp_id.
- Auth codes (OIDC and cookie exchange) are stamped with the issuing
  realm and verified at redemption; remote-auth permits mint the exchange
  code for the *requesting* device's realm.
- OIDC provider state (clients, signing keys) is per realm; token,
  userinfo, keys and backchannel-logout endpoints use the dispatched
  realm; refresh re-stamps the session issuer.
- /.well-known/webauthn serves the realm's related origins (ROR).
- Admin /server-config replaced by /realms CRUD (validated cross-realm,
  registry rebuilt on change); permission domains may reference any
  realm's hosts or clients; /settings reports the realm's own vs
  effective auth host.
- paskia.globals and the runtime-backed hostutil helpers are gone.
2026-09-06 04:11:22 +00:00
LeoVasanko 4591a023dd Clean-slate storage: realms Config, Credential.rp_id, Session rp_id/issuer, per-realm OIDC
- Config is now a realm list (first = default); DB.oidc keyed by rp-id
- Database at fixed paskia.kantadb; user files under paskia.data/users/
- Legacy <rp-id>.paskiadb reader/converter in db/legacy.py (to be deleted eventually)
- paskia init / paskia serve CLI split; serve adopts a lone legacy database
- Realm registry (paskia/realms.py) with cross-realm validation
- Per-realm OIDC keys in oidjwt; backchannel logout uses Session.rp_id/issuer
- Schema migrations discarded; on-disk legacy format assumed current
2026-09-06 03:50:06 +00:00
LeoVasanko 2da1ce777a Multi-site plan v4: combined paskia.kantadb, bootstrap-only CLI, runtime realm management 2026-09-06 03:19:42 +00:00
LeoVasanko 383c9f472e Add public access mode (public=1) to forward auth
/auth/api/forward?public=1 passes requests through with a Remote-Public
header (anonymous/forbidden/authenticated) instead of 401/403, so routes
can allow anonymous visitors while still identifying logged-in users.
Reauth (max_age) still requires the auth flow. Documented in Headers.md,
api/forward.md, Integration.md and all proxy guides.
2026-09-05 16:06:32 +00:00
LeoVasanko 8c2809a879 Update fastapi-vue-setup, make use of its access logging facility. 2026-09-05 14:36:25 +00:00
LeoVasanko 3912b5473e Fix Caddyfile indentation 2026-08-15 05:54:28 +00:00
LeoVasanko 223429d51c Add renew=0 query arg on validate, useful when only a permission check is required. v1.5.6 2026-08-11 01:46:56 +00:00
LeoVasanko 2456730f70 Check max-age only after checking permissions: if neither is passing, we want a 403 error; simply authenticating again won't fix it so don't bother reauth flow. After forbidden flow e.g. account change we are already good with max-age too. v1.5.5 2026-08-11 00:56:01 +00:00
LeoVasanko f74bf3ebe6 Require Python 3.14, ruff formatting for simpler typing. 2026-08-11 00:46:45 +00:00
LeoVasanko 79074dd4f1 OR semantics in perm query arg, strict parsing, segment-aware wildcards
perm=a|b+c now means (a or b) and c; repeated perm args remain ANDed.
Out-of-spec values (empty alternatives, chars outside the scope charset,
stray %2B) are rejected with 400 instead of being silently misparsed;
extra spaces between groups are tolerated. Forward endpoint 400/500
details name /auth/api/forward as origin without echoing query args.
Wildcards are now filename-like: * stays within a :- or /-separated
segment, ** spans segments, partial segments allowed. Slash added to
allowed scope characters for path-based permissions.
2026-08-11 00:44:58 +00:00
LeoVasanko 00ef0ae2e7 Update API and proxy docs 2026-08-10 21:35:46 +00:00
LeoVasanko 6f5287e070 Avoid clearing session.user_agent if a validation request lack this header. Backend-initiated session validations may not have the data. 2026-08-10 14:09:42 +00:00
LeoVasanko 051e1bbb41 Replace paskia.db.logging with kanta's built-in logging (kanta 0.7.0)
The vendored db/logging module duplicated what kanta now provides:
diff formatting, UUID-to-label resolution via logfmt callbacks, unsafe
character filtering and value truncation. Censoring of oidc.key material
moves into the format_log_uuid logfmt callback in db.lifecycle, taking
care to hide only the value, not the 'key' path component itself.
v1.5.4
2026-08-09 23:25:16 +00:00
LeoVasanko 4b156b712c Proper handling of auth site runtime change done via web interface, making the change immediately effective. Kept in origins list that is still also visible on the same dialog, where it can be removed if needed. 2026-08-09 23:00:22 +00:00
LeoVasanko df8a7c0026 Cleanup of admin user panel where incorrect toast messages were issued after changes. 2026-08-09 21:45:23 +00:00
LeoVasanko 9b28250391 Upgrade to kanta 0.4.0:
- Make use of its new features and cleanup our interfacing and init/shutdown processes and migrations
- Clean up circular deps, simplify app init
- Add specific pytest for CLI main to cover the changes
v1.5.3
2026-06-13 21:59:18 +00:00
LeoVasanko b9aec6bb58 Remove built-in database, replace with kanta package. No disk format changes. v1.5.2 2026-06-12 19:39:30 +00:00
LeoVasanko c79cb497ee Fix profile image path on OIDC. v1.5.1 2026-05-22 02:45:12 +00:00
LeoVasanko 9f50c8c20d Missing file v1.5.0 2026-05-22 01:40:53 +00:00
LeoVasanko 816c7a681e Update E2E tests for new database folder. 2026-05-22 01:40:09 +00:00
LeoVasanko d31c09084e Make rpid.paskiadb a folder containing the database and the files in one. Migrates existing old format rpid.paskiadb file to main.db. 2026-05-22 01:22:35 +00:00
LeoVasanko cc938dd306 Fix a call to loadOrgs when renaming a role, missed in earlier refactoring where we use loadAdminData() for refreshing. 2026-05-22 00:31:06 +00:00
LeoVasanko 36db1e7e56 Fix showing of admin reset link also in devserver where the logging configuration was eating the message. 2026-05-22 00:22:04 +00:00
LeoVasanko 95c163e37a Add profile picture support
- backend avatar storage and OIDC picture claims
- profile and admin UI components
- admin org cards, tests, and docs
2026-05-21 23:57:48 +00:00
LeoVasanko 2d0d17c307 fix remote auth: create session for requesting device host v1.4.1 2026-04-30 21:47:47 +00:00
LeoVasanko 10980ad39b fix type hints: update_session and set_session_host key type 2026-04-30 21:47:46 +00:00
LeoVasanko 42b54cf645 Release 1.4.0 v1.4.0 2026-04-29 20:48:12 +00:00
LeoVasanko 232d0e1ae0 Added configurable timeout settings to paskia-js, used in our frontend as well. The default fetch timeout has been changed to 10s from prior 1s, but we maintain 1s for auth endpoints in internal use. 2026-04-29 20:23:38 +00:00
LeoVasanko e97a2b3291 Improved color compatibility across terminals that may have very different ideas of yellow shades. 2026-04-29 16:23:34 +00:00
LeoVasanko cde709e252 Print original METHOD /path on auth/api/forward access log entries. Previously the method was not printed, and nothing was printed for 401 without a session. v1.3.7 2026-04-29 15:47:37 +00:00
LeoVasanko 72d76df35d Log session id from handlers on selected auth routes. Adds request.state.log_extra for handlers to print access log extra. v1.3.6 2026-04-29 03:02:30 +00:00
LeoVasanko 1a742fc0e7 Cleaner websocket access log. 2026-04-29 02:45:20 +00:00
LeoVasanko 0b29654d6f Log original path on forward endpoint. Added logging extra argument for such additions on access logs. 2026-04-29 02:16:48 +00:00