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.
9.3 KiB
9.3 KiB
Tessera — behavioral specification (v1)
Tessera is a self-hosted backup vault. This document is the contract for metaphors, state machines, error copy, and security baseline.
Metaphor glossary
| Internal concept | User-facing term | Notes |
|---|---|---|
| Repository | Vault | One encrypted store per host |
| Scheduled / manual job | Orbit | “Your data circles the vault on a schedule” |
| Point-in-time backup | Snapshot | A tile on the vault ring |
| Remote machine | Outpost | Runs tessera-agent |
| Encrypted link to hub | Wormhole | Pair once; beam snapshots upstream |
| Retention | Decay | Old snapshots fade per policy |
| Restore | Reconstitute | Destructive-capable; always confirm |
| Deduped deltas | “Only stardust that changed” | Tooltip only—not headline copy |
Status dots (Lune-style)
| Color | Meaning |
|---|---|
| Green | All orbits current; last snapshot succeeded |
| Amber | Orbit running, pairing waiting, or reconstitute countdown |
| Grey | Outpost offline or never paired |
| Red | Last snapshot or reconstitute failed |
State machine: orbit run
┌─────────────┐
schedule/ │ idle │
manual snap └──────┬──────┘
│ start
▼
┌─────────────┐
┌────│ preparing │──── timeout ──► failed
│ └──────┬──────┘
│ │ provider ready
│ ▼
│ ┌─────────────┐
│ │ capturing │◄── dry-run: skip vault write, end at rehearsed
│ └──────┬──────┘
│ │ packs sealed
│ ▼
│ ┌─────────────┐
│ │ sealing │
│ └──────┬──────┘
│ │ index updated
│ ▼
│ ┌─────────────┐
└───►│ applying │ decay after success only
│ decay │
└──────┬──────┘
│
┌───────────┴───────────┐
▼ ▼
┌─────────────┐ ┌─────────────┐
│ completed │ │ failed │
└─────────────┘ └─────────────┘
Invariants
- Only one active capture per orbit per vault at a time (hub enforces lock).
- Automatic decay runs only after a successful non-dry-run seal and applies to the captured orbit.
- Dry-run (“rehearse”) never writes snapshot metadata to the vault store.
State machine: reconstitute
user picks snapshot + target
│
▼
┌─────────────┐
│ confirming │ show evidence: size, age, paths/DB name
└──────┬──────┘
│ user confirms
▼
┌─────────────┐
│ countdown │ 12s grace; abort returns to idle
└──────┬──────┘
│ timer elapsed
▼
┌─────────────┐
│ restoring │
└──────┬──────┘
│
┌────────┴────────┐
▼ ▼
completed failed
Copy during countdown: “Reconstituting in {n}s — abort restores nothing.”
State machine: wormhole pairing
Hub Outpost (agent)
│ │
│ display 6-char pairing code │
│◄───────────────────────────────│ user runs: tessera wormhole pair
│ │
│ POST /wormhole/claim │
│◄───────────────────────────────│
│ │
│ issue device token + id │
│───────────────────────────────►│
│ │
│ Bearer upload token on upload API │
│◄───────────────────────────────│
States: unpaired → code_shown → claimed → active → offline (heartbeat miss).
Error UX copy (English v1)
| Situation | User message | Telemetry (expandable) |
|---|---|---|
| Vault locked | “Another orbit is still circling the vault. Try again when it finishes.” | orbit_lock:{id} |
| Wrong passphrase | “That key doesn’t unlock this vault.” | No stack traces |
| Provider missing | “We couldn’t reach the source at this outpost.” | Provider error string |
| Postgres dump failed | “The database wouldn’t yield a snapshot.” | pg_dump exit code |
| Disk full | “The vault is out of space—free room or widen the hold.” | Bytes needed |
| Wormhole expired code | “That pairing code has burned up. Generate a fresh one on the vault.” | TTL 10m |
| Reconstitute aborted | “Reconstitute cancelled. Nothing was changed.” | — |
| Decay pruned | “{n} old snapshots decayed per your policy.” | Snapshot IDs |
Tone: short sentences, metaphor in headings, facts in telemetry panels.
Security baseline
- Vault key: New vaults use Argon2id (19 MiB, time cost 2, parallelism 1). The salt is
keys/tessera.salt(mode 0600) and the parameters arekeys/kdf.json. A salt with nokdf.jsonstays 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 passphrasedev-vault-key. New snapshot metadata is AES-GCM ciphertext in{id}.json.enc. Existing plaintext{id}.jsonfiles still list and restore. Chunk index JSON stays plaintext. - Hub auth:
TESSERA_ADMIN_TOKENis 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 sendAuthorization: Bearer <token>orX-Tessera-Admin-Token. The compare is constant time./health, OpenAPI, wormhole claim, and wormhole upload are not on this gate. The default listen address is127.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. - 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.
- Wormhole: Uploads require
total_bytes. Chunks are written atoffsetinto a mode0600.partfile. When the recorded ranges cover the object from byte 0, the hub seals the bytes withVault::snapshot(encrypted metadata), prunes decay, and deletes the.part. A later chunk on a sealed session is 409.TESSERA_WORMHOLE_MTLS=1(ortrue) starts a separate rustls listener that requires a client certificate. It needsTESSERA_WORMHOLE_CERT,TESSERA_WORMHOLE_KEY, andTESSERA_WORMHOLE_CLIENT_CA.TESSERA_WORMHOLE_LISTENdefaults to127.0.0.1:8788. While that listener is running, the plain HTTP upload routes return 403. Anhttps://agent needsTESSERA_WORMHOLE_CA,TESSERA_WORMHOLE_CLIENT_CERT, andTESSERA_WORMHOLE_CLIENT_KEY. - 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 parsespostgres://orpostgresql://, writes the password to a mode0600pgpass file, and passesPGPASSFILE,PGHOST,PGPORT,PGUSER, andPGDATABASE. The URL and password are not process arguments. - Control plane: SQLite (
data/tessera.db) holds metadata, pairing codes, upload tokens, and upload ranges — no backup payloads. - Audit: Pairing, wormhole seal, reconstitute start/complete, and decay prune are logged to
audit_log.
Decay presets (friendly → policy)
| Preset | Rule |
|---|---|
week-of-dailies |
Keep 7 daily snapshots |
month-of-weeklies |
Keep 4 weekly |
year-of-monthlies |
Keep 12 monthly |
custom |
Hub-stored JSON policy (see tessera-core::decay) |
API conventions
- REST JSON under
/api/v1/ - OpenAPI 3.1 via hub
utoipa - Webhooks (struct only v1):
orbit.completed,orbit.failed,decay.pruned,outpost.offline