chore(server): checkpoint deployed services and unfinished forums

User requested a checkpoint and stopped all agents. Deployed artifacts remain the last verified releases; unfinished settings/categories/forums are preserved as WIP. See TODO/roadmap for verification and remaining release/updater work.
This commit is contained in:
Loki 2026-11-01 15:31:20 +01:00
parent d6d406bbf5
commit c18ccadf99
Signed by: boba
GPG key ID: 253067914055423B
96 changed files with 8665 additions and 276 deletions

View file

@ -55,7 +55,7 @@ Per address 1 per 60 s and 5 per hour; per source (`X-Forwarded-For`, as GitHub
Addresses are trimmed and lowercased; only ASCII, a local part of `[a-z0-9._%+-]` without leading/trailing/double dots, at most 64 characters, a multi-label hostname whose last label is alphabetic, at most 254 characters in total. `+tag` is not stripped and Gmail dots are not folded. Unusual legal addresses are rejected on purpose.
The identity is `external_identities(provider='email', subject=<normalized address>)`, reusing the existing table so one address maps to one account, and it can never collide with `github.com` subjects. A matching GitHub account or email is never merged automatically. A first successful verification creates an account with a generated `u_<uuid>` handle and the neutral display name `Vnox user`; the local part of the address is never used. Choosing a handle and display name after registration is not implemented yet (an own avatar can be uploaded, see below) (see `design/accounts-and-avatars.md`). The address is kept in plain normalized form in `external_identities` because later features (security notices, adding a second sign-in method) need it; it is used for nothing except sending codes today.
The identity is `external_identities(provider='email', subject=<normalized address>)`, reusing the existing table so one address maps to one account, and it can never collide with `github.com` subjects. A matching GitHub account or email is never merged automatically. A first successful verification creates an account with a generated `u_<uuid>` handle and the neutral display name `Vnox user`; the local part of the address is never used. The profile API below selects a handle and display name after registration; browser onboarding is still separate work. An own avatar can be uploaded, see below. The address is kept in plain normalized form in `external_identities` because later features (security notices, adding a second sign-in method) need it; it is used for nothing except sending codes today.
### Mail and logging
@ -104,3 +104,63 @@ The provider avatar URL stays on `accounts.avatar_url` and is the fallback after
- Avatars are public to anyone who knows the id; ids are not secret but are not listed anywhere. Identical images from two accounts share an id.
- Deleted photos can remain in database backups. The project owner decided that backups keep deleted data for up to 30 days; this needs backup rotation to be implemented and is not enforced by the Hub.
- Decoding uses the `image` crate with only the `png`, `jpeg` and `webp` features. `cargo audit` reported no advisories when this was added. Decoder bugs in these crates are the main residual risk; decoding is bounded in size, memory and concurrency.
## Account profile and registration completion
`PUT /v1/account/profile` accepts JSON with exactly `handle` and `display_name`.
It requires the session cookie, exact Origin and X-CSRF-Token, like avatar changes.
The body limit is 1 KiB. Successful responses are `200 {"user": ...}`; session and
email verification responses also include `user.profile_complete`. Existing and
new accounts start with `profile_complete: false`; generated `u_<uuid>` handles
are placeholders, never selected automatically from a provider identity.
Handles are trimmed, ASCII-lowercased, 3 to 24 characters, start with a letter,
and contain only ASCII letters, digits and underscore. Names starting with `u_`
are reserved for generated accounts; `admin`, `administrator`, `root`, `system`,
`support`, `vnox`, `central`, `moderator`, `everyone` and `here` are reserved.
A unique database index enforces case-insensitive ownership, including concurrent
claims. Once selected, a handle cannot change; submitting the same normalized
handle permits display-name changes and makes retries safe. Display names are
trimmed, 1 to 64 Unicode scalar values, with control characters and Unicode
bidirectional formatting controls rejected. Names are plain text, not markup.
Errors: `400 invalid_request`, `422 invalid_handle` / `invalid_display_name`,
`409 handle_taken` / `handle_locked`, standard session/Origin/CSRF errors,
`413` for bodies over the limit, `429 try_later`, `503 try_later`. Malformed JSON,
unknown fields and missing fields are rejected without changing the account.
`/v1/info` advertises `capabilities.account_profile: "enabled"` independently of
which sign-in providers are configured. Profile writes are limited to 10 attempts per account and 30 per source per hour,
with bounded in-memory counters (reset at restart). Authentication precedes body
reading; errors and success responses are no-store. Provider sign-in preserves
the selected profile. User ID and provider bindings never change.
## Desktop browser approval (LNEx v4)
Desktop enrollment uses the existing email/GitHub browser session and explicit
approval at `/desktop`. Profile completion is not required. The public pairing
code and full local Ed25519 public key appear in the browser; private keys and
bearer credentials never do. The full protocol and claim format are specified in
[central-account.md](../docs/02-protocol/central-account.md).
- `POST /v1/auth/desktop/start`: `{public_key}` returns a private `device_secret`,
public `user_code`, `verification_uri`, `expires_at`, and five-second `interval`.
- `GET /v1/auth/desktop/request?code=...`: public key, expiry, approval state.
- `POST /v1/auth/desktop/approve`: `{code}`, authenticated session, exact Origin,
session CSRF header; requires explicit user action.
- `POST /v1/auth/desktop/poll`: `{device_secret}` returns 202 while pending;
approved requests are consumed once and return account proof, refresh secret,
account details, and proof expiry.
- `POST /v1/auth/desktop/cancel`: `{device_secret}` cancels either pending request
or consumed enrollment, covering cancellation and lost-response races.
- `POST /v1/auth/desktop/refresh`: `{refresh_secret}` issues a fresh proof only
for an unexpired, unrevoked enrollment.
- `POST /v1/auth/desktop/revoke`: `{refresh_secret}`, idempotently revokes it.
Requests expire in ten minutes; enrollments expire in thirty days. Hub stores
only hashes of pairing, device, and refresh secrets. Proofs last at most ten
minutes and bind the Central account UUID to the local identity key. All LNEx v4
gateways require a proof verified against explicit issuer UUID/public-key trust;
there is no anonymous or private-server exception. Revocation prevents new proof
issuance; issued proofs and existing gateway sessions retain their documented
lifetimes. Desktop logout disables local admission immediately and retains a
private revocation tombstone for retry if Central is unavailable.