fix: harden the vault before release
Require a private passphrase and loopback-or-token admin auth. New vaults use Argon2id; existing PBKDF2 vaults still open, and new snapshot metadata is encrypted. Wormhole tokens survive restart, offset uploads seal into the vault, and client-certificate uploads are real. Reject the command provider and keep Postgres passwords off the process arguments. Keep the interruptible canvas motion.
This commit is contained in:
15
docs/SPEC.md
15
docs/SPEC.md
@@ -112,7 +112,7 @@ Tessera is a self-hosted backup vault. This document is the contract for metapho
|
||||
│ issue device token + id │
|
||||
│───────────────────────────────►│
|
||||
│ │
|
||||
│ mTLS or Bearer on upload API │
|
||||
│ Bearer upload token on upload API │
|
||||
│◄───────────────────────────────│
|
||||
```
|
||||
|
||||
@@ -139,12 +139,13 @@ Tone: short sentences, metaphor in headings, facts in telemetry panels.
|
||||
|
||||
## Security baseline
|
||||
|
||||
1. **Vault key:** Argon2id-derived key from passphrase; key file `keys/tessera.key` (mode 0600). Never logged.
|
||||
2. **Hub auth (v1):** Local admin password → HTTP-only session cookie; hook point for OIDC later.
|
||||
3. **Agents:** No vault master key. Hub issues **scoped upload tokens** per outpost/orbit after pairing.
|
||||
4. **Wormhole:** v1 token-based HTTPS upload; mTLS optional when `TESSERA_WORMHOLE_MTLS=1` and certs present.
|
||||
5. **Control plane:** SQLite (`data/tessera.db`) holds metadata only—no backup payloads.
|
||||
6. **Audit:** Pairing, reconstitute start/complete, decay prune logged to `audit_log` table.
|
||||
1. **Vault key:** New vaults use Argon2id (19 MiB, time cost 2, parallelism 1). The salt is `keys/tessera.salt` (mode 0600) and the parameters are `keys/kdf.json`. A salt with no `kdf.json` stays PBKDF2-HMAC-SHA256, 100,000 iterations, so vaults created before Argon2id still open. The derived key is not stored. Never log the passphrase. New vaults refuse the published passphrase `dev-vault-key`. New snapshot metadata is AES-GCM ciphertext in `{id}.json.enc`. Existing plaintext `{id}.json` files still list and restore. Chunk index JSON stays plaintext.
|
||||
2. **Hub auth:** `TESSERA_ADMIN_TOKEN` is optional and local. When it is unset, the hub logs that snapshot, orbit list/create/run, reconstitute, and pairing routes are open to loopback peers only; every other peer gets 401. When it is set, every peer, including loopback, must send `Authorization: Bearer <token>` or `X-Tessera-Admin-Token`. The compare is constant time. `/health`, OpenAPI, wormhole claim, and wormhole upload are not on this gate. The default listen address is `127.0.0.1:8787`. The canvas does not send the token, so a token-protected hub and a Docker-published port (the peer inside the container is not loopback) will 401 those routes from the page. OIDC is not implemented.
|
||||
3. **Agents:** No vault master key. After pairing, the hub issues an upload token stored in SQLite. The token survives a hub restart. Claim is an atomic update of a pairing code that has not expired.
|
||||
4. **Wormhole:** Uploads require `total_bytes`. Chunks are written at `offset` into a mode `0600` `.part` file. When the recorded ranges cover the object from byte 0, the hub seals the bytes with `Vault::snapshot` (encrypted metadata), prunes decay, and deletes the `.part`. A later chunk on a sealed session is 409. `TESSERA_WORMHOLE_MTLS=1` (or `true`) starts a separate rustls listener that requires a client certificate. It needs `TESSERA_WORMHOLE_CERT`, `TESSERA_WORMHOLE_KEY`, and `TESSERA_WORMHOLE_CLIENT_CA`. `TESSERA_WORMHOLE_LISTEN` defaults to `127.0.0.1:8788`. While that listener is running, the plain HTTP upload routes return 403. An `https://` agent needs `TESSERA_WORMHOLE_CA`, `TESSERA_WORMHOLE_CLIENT_CERT`, and `TESSERA_WORMHOLE_CLIENT_KEY`.
|
||||
5. **Providers:** Filesystem and Postgres are in this release. The command provider is rejected with `command provider is outside this release; use filesystem or postgres`. Postgres parses `postgres://` or `postgresql://`, writes the password to a mode `0600` pgpass file, and passes `PGPASSFILE`, `PGHOST`, `PGPORT`, `PGUSER`, and `PGDATABASE`. The URL and password are not process arguments.
|
||||
6. **Control plane:** SQLite (`data/tessera.db`) holds metadata, pairing codes, upload tokens, and upload ranges — no backup payloads.
|
||||
7. **Audit:** Pairing, wormhole seal, reconstitute start/complete, and decay prune are logged to `audit_log`.
|
||||
|
||||
---
|
||||
|
||||
|
||||
12
docs/UI.md
12
docs/UI.md
@@ -4,12 +4,14 @@ The persistent viewport maps backup jobs and recovery points. The black hole rep
|
||||
|
||||
## Viewport and consoles
|
||||
|
||||
- **Flowing** animates the projected orbits and the black hole's accretion disk. **Locked** freezes their motion and prioritizes labels for the selected, failed, and running orbits. Pause or resume from the map toolbar. Selecting an orbit locks the map. Reduced motion starts in Locked mode.
|
||||
- **Flowing** animates the projected orbits and the black hole's accretion disk. Pause or resume from the map toolbar. The map eases to a stop before showing labels and moons in **Locked** mode. Selecting an orbit also locks the map. Reduced motion locks it immediately.
|
||||
- Select a star or use the orbit register. The register prioritizes failed and active jobs and supports the up/down arrow keys. The inspector includes the capture action and full snapshot history.
|
||||
- The first three recovery points of the selected orbit appear as moons when the map has room. Select a moon or history entry to review the snapshot and start a restore. Escape closes the console. Restore countdown and polling continue if the console closes.
|
||||
- Hub connectivity is separate from backup health. Capture targets the named orbit. An incoming meteor represents a confirmed new snapshot. Failures and rehearsals show text feedback.
|
||||
- The map shows up to 55 overview orbits and reserves one slot for inspecting an orbit beyond that limit. The register provides access to every orbit. On narrow screens the map, register, and inspector stack vertically.
|
||||
- **Big Screen** expands the map and keeps summary counts, motion controls, and a floating navigation dock. The browser can show it in native fullscreen. Use **Exit big screen** or Escape to return to the workspace.
|
||||
- Drag the active navbar item sideways and release to open the destination. The regular navbar uses text and a sliding underline. The Big Screen dock uses labeled icons and a liquid highlight.
|
||||
- The navbar stays available above the side panel so you can switch directly between consoles. In the regular workspace it becomes a floating text dock in the same top position. Big Screen keeps its icon dock at the bottom.
|
||||
|
||||
## Data and rendering
|
||||
|
||||
@@ -18,6 +20,14 @@ The persistent viewport maps backup jobs and recovery points. The black hole rep
|
||||
- Successful capture preserves HTTP 204 and supplies `X-Tessera-Snapshot-Id` when it retained a new snapshot. Automatic decay applies to that orbit's history.
|
||||
- The scene uses SVG with static artwork and one animation clock. The clock pauses when the tab is hidden. Labels are laid out in screen coordinates.
|
||||
|
||||
## Animation guideline
|
||||
|
||||
- Use the installed Framer Motion API from `motion/react`. Declarative `motion` components inherit the physics spring from `MotionConfig` in `web/src/main.tsx`. Imperative animations share `uiSpring` from `web/src/lib/motion.ts`. Tune stiffness, damping, and mass for the interaction.
|
||||
- Keep the element, its React key, and its MotionValues stable while a target can change. Update the scalar `animate` target, call `animate(value, nextTarget, uiSpring)` on the same MotionValue, or call `.set(nextTarget)` on a `useSpring` value. Motion automatically replaces the active animation and inherits the live value and velocity. Leave `from`, `velocity`, and fixed timing options unset for these retargets. For colors and other compound styles, spring a numeric mix amount or progress value and derive the visual property from it.
|
||||
- Keep `AnimatePresence` mounted and use a stable child key so a reopening element can reverse its exit. Make an exiting overlay inert and release its hit area immediately. Track direct manipulation one-to-one and seed the spring with release velocity when handing control over from an external gesture.
|
||||
- Keep CSS state changes immediate. Use Motion springs for visual transitions, including hover and loading feedback. Reserve repeating springs for ambient indicators and give them a static state under reduced motion. For continuous simulation, keep the path on its existing clock and spring its speed or progress. A new event can start a distinct path at its own origin.
|
||||
- Honor live changes to `prefers-reduced-motion`. The app applies declarative targets immediately. Imperative effects must stop and jump to the appropriate static state themselves. Verify reversals before settling, the final target, and reduced motion in a browser.
|
||||
|
||||
## Local verification
|
||||
|
||||
Build the web UI before building the hub, which embeds the generated assets.
|
||||
|
||||
Reference in New Issue
Block a user