feat: require authentication and own uploads per Outpost (auth M0)

- auth is mandatory by default, including loopback and local proxies; startup refuses a hub with no credentials; TESSERA_LOCAL_DEVELOPMENT is explicit and loopback-only
- legacy uploads are bound to an owning Outpost (PUT /api/v1/orbits/:id/outpost); unowned orbits and sessions fail closed
- typed Principal and payload-free audit_events table
- endpoint authorization contract with tests comparing it to the router
- A00 compatibility spike (tests/auth-compat) and library research
- archive the superseded A00-A25 plan

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-14 12:59:08 +07:00
parent f6a41ee702
commit a9ebded5ba
22 changed files with 5355 additions and 35 deletions

View File

@@ -85,6 +85,20 @@ Use the snapshot detail to download or remove an archive. Database snapshots can
## Operator sign-in
Authentication is required by default, including requests from loopback and a
local reverse proxy. Before upgrading, configure the emergency operator hash/name
and/or the separate API admin token. Startup refuses a hub without credentials.
An existing install with neither configured must bootstrap credentials locally
before restarting; there is no first-user auto-admin or public registration.
Use a named individual emergency operator, not a shared daily SSO account.
For synthetic local development only, `TESSERA_LOCAL_DEVELOPMENT=true` explicitly
enables anonymous loopback access when no operator/token is configured. Both
listeners must bind loopback; wildcard and non-loopback binds are rejected.
Forwarded requests are rejected in this mode, but that is not a proxy trust
boundary: never reverse-proxy a development listener. Compose keeps the mode off
and needs operator/API credentials even with a localhost published port.
Generate an Argon2id hash and set `TESSERA_OPERATOR_PASSWORD_HASH` to the result. The hub reads the password from stdin in hash mode. For example, from an interactive Bash shell:
```bash
@@ -95,6 +109,17 @@ unset tessera_operator_password
Set `TESSERA_OPERATOR_NAME` for the audited identity, or use the default `operator`. Serve the browser over HTTPS outside loopback. Sessions expire after eight hours or a hub restart. Browser mutations require the session's CSRF token. API and CLI callers use the separate `TESSERA_ADMIN_TOKEN`. Use the bundled HTTP CLI on the hub's loopback listener when sending the token.
Legacy full-upload agents now need an explicit orbit assignment. With operator
CSRF or an admin API token, call `PUT /api/v1/orbits/{orbit-id}/outpost` with
`{"outpost_id":"<paired-outpost-uuid>"}`. Only active paired Outposts and legacy
Wormhole orbits are accepted; managed capture assignment remains on its profile.
Existing unassigned orbits and upload sessions without an owner fail closed.
Review the mapping, bind the orbit, then restart the upload to obtain a new owned
session. No owner is inferred from a name or an old token. This does not delete
old snapshots or partial uploads; operators can remove abandoned partial files
after stopping the old agent. Rebinding invalidates in-flight uploads from the
previous Outpost.
## Optional S3 copy
Configure `TESSERA_OFFSITE_REPOSITORY=s3:https://s3.example.org/tessera-backups/managed` with a dedicated prefix and point `TESSERA_OFFSITE_PASSWORD_FILE` to the independent Restic password. Supply AWS credentials via the hub service environment or the provider's credential chain. In Docker, mount the password file at the container path using a read-only mount.