Skip to content

Latest commit

 

History

History
43 lines (25 loc) · 9.27 KB

SPEC-DELTA.md

File metadata and controls

43 lines (25 loc) · 9.27 KB

Space purge contract additions

Verified frozen amendments: v1.5 contract 8b9bfdab43b78f11edcf5c76efbb71c4d2db109c6b2a95d37f91cf8f219cf494, vectors ecb7fb4e891f650a8903584dc9bb7745fa582643716874c6678ddf8c8987162e; v1.6 contract 9810fb9a6167a860c06d35e3a4e8a28447f9c9f48b0bc02f2adcc3749a71c4b5, vectors 4100f762b6f63c39441bfc0f75978eb7982c5f1e896f7de786587d8ccb562aa1. These extend the immutable v1.4 baseline. The prefix-HMAC v1.7 amendments below are frozen.

  • Write space ledger records at acceptance (purging) and completion, and owner-retirement records before acknowledging retirement. Owner keys use _purge-ledger/owners/<key_id>/<owner-HMAC>; all ledger objects live outside space prefixes.

  • Each record carries a key ID, purge or retirement ID, state, timestamp, and a MAC under the persistent node tombstone key over those fields. Reconciliation acts only on records whose MAC verifies. Every reconciliation-triggered purge raises an alert containing counts and HMACs only.

  • Before serving at startup or after restore, import owner retirements and reconcile space records. If the ledger is unreadable, refuse space reads and writes until reconciliation completes.

  • Object Lock and IAM deny rules are deployment configuration. Code works without them; the deployment runbook identifies the operator's AWS configuration step.

  • Phase 1 uses an explicit configured list of TinyCloud-operated hosts, each with a local retirement record and independent ledger. Registry write/import is phase 2.

  • Add an owner-signed list-my-spaces route for complete enumeration of every app's spaces under that owner.

  • TINYCLOUD_HOST_ID is a required non-secret stable host identifier for lifecycle routes, matching [a-z0-9-]{1,63}. Never derive it from the node DID. Phase-1 host configuration maps that ID to an exact HTTPS origin; registry mapping is phase 2.

  • Ordinary live-space authentication behavior stays unchanged. For a non-owner, a purged or retired space enters the never-created-space path itself; do not hard-code 404 or normalize live permission misses. Load space and fence state on the same path, evaluate authority, then map the result. Raw-response tests derive the expected status, body and every header from the never-created case, with no grant and with a once-valid proof. After terminal deletion, only a direct owner did:pkh invocation receives the 410 JSON envelope. A session-key invocation follows the missing-proof/never-existed path; no new inline proof transport or retained deleted proof bytes identify old sessions.

  • Acceptance records authenticate a keyed HMAC of every exact physical storage prefix used by the space, including a long name's hashed SQL object prefix. Restore reconciliation enumerates actual prefixes and matches their HMACs; it never reverses an HMAC, retains an encrypted SpaceId mapping, guesses ownership, or deletes unmatched prefixes. A backend remains unavailable until this reconciliation is supported.

  • A verified completion ledger entry is an irreversible fence, not proof that the database cleanup transaction committed. Startup must redo any remaining cleanup before serving restored rows.

  • Verified wire appendix: tc-2871-space-delete-wire-appendix-v1.1.md, SHA-256 7c97793d01fe4cab76f165ffb342c5efd0818ca02facda0f7a73bdd52cd7c4a1. This interface note is distinct from the superseded historical v1.1 contract.

  • Separate resource wire scope: owner-direct POST /resource/list, /resource/dependencies, /resource/purge, and /resource/purge/status, with exact tinycloud.resource/list, tinycloud.resource/dependencies, and tinycloud.resource/delete actions. Every lifecycle response binds hostId; resource lists use the same max-500 keyset pages and terminal-page semantics as space lists. The separately frozen resource wire below governs these routes.

  • Erase-30 (Naomi 11-19): the resource handlers are off the erase-30 path. /resource/list and the storage::resource_review adapter are removed, along with their resource-only tests. The resource wire freeze stays as a frozen contract with no implementation on this branch. Migrations, models, ledger resource kind/retirement_snapshots, the collector and fence helpers stay compiled because the space path shares or tolerates them.

Frozen v1.7 / v1.7.1 and resource wire review

Naomi froze v1.7 contract a238a52070046dce2d37d71514c5d6ce932ff0ee8cd1180104c397969485701d, vectors 28d27fd04b985d99b48494268457bf0e9d44a8b2200ffd59f5314f013b9143a6, and additive v1.7.1 contract 6930ef1165ef3c3653e689135175fb9a547ef29199c189c67072876fd3ca9442, vectors 5ed8269bce6dafd59b5772a69f7a00e27f4d499ba98c162c1de470010bf7d336. Verified local bytes; stale draft headings do not override her freeze.

Every lifecycle invocation binds signed fct:[{idempotency_key:<UUID>,hostId:<target>}]; verify signature before comparing host, and compare host before state lookup or nonce consumption. Lists retain durable nonce replay protection but no durable list request/idempotency binding or page snapshot. Fresh nonce plus reused list key is harmless. New cross-host and stateless-list tests cover these rules. Naomi authorized only adding hostId to existing lifecycle test helper facts; no existing assertions changed.

Resource wire v1 and additive v1.1 are separately frozen by Naomi after Bobbie PASS: contract 617eaaef63d3227e57ae3b393a3059e077f4f2b483db68853f18bf9cd6d99159, vectors 061d88c74dc24baf7da564e2af4658a3aa707f0b429b2f6c6b7cf833dd05fb77; amendment 98c0c88382bf5837cd8a4b446b2dc8e7b2917db5feb4fb7dbcac98030b8b218a, vectors 0a7e2566e4cffea7c25fa7898af8c4ffeb1d957f73603fc6e3a0a0e64b48ee90. Pure pre-lookup owner mismatch produces identical responses regardless of existence. Dependencies require review BEFORE acceptance/fencing: nonzero dependencies without node-verified ledgered proceed return 409 dependency_review_required without fence/job; new dependencies at destruction stop the job. The authenticated decision transport is separately frozen through v1.2.2; its production keys are unprovisioned and resource purge remains unmounted.

Prefix proof encoding uses ledger version 2, with sorted prefixes:[{store_kind,prefix_hmac}] authenticated in the entry MAC. Store kinds distinguish kv-filesystem, kv-s3, sql-filesystem, sql-s3, sqlite-cache and duckdb-cache; enabled cache roots are included even when empty. Prefix HMAC input uses domain tinycloud-physical-purge-prefix-v1\0, big-endian u64 byte length plus store-kind bytes, then big-endian u64 byte length plus exact store-relative prefix bytes. Entry MAC domain is tinycloud-space-purge-ledger-v2\0 and fixed-order JSON fields (version,key_id,kind,target_hmac,operation_id,state,timestamp,prefixes). Version-1 historical signatures retain their original format and cannot construct a prefix-only repair proof. Completion must copy the authenticated acceptance inventory rather than re-list after deletion. Physical transports still validate the exact prefix before I/O. This encoding implements the frozen semantic prefix binding; it does not enable reconciliation or serving by itself.

Review authority and retirement provenance

The resource decision transport is frozen through v1.2.2: RFC 8785 JCS parsed payloads and snapshots, dedicated Ed25519 writer keys, response-only resourceId-to-HMAC mapping, per-resource keyed fingerprints, at most 48-hour decisions, and independent operator-signed monotonic revocations read fresh at acceptance and under lock before destruction. Review decisions are consumed atomically with acceptance and never substitute for the owner's signature. Production key provisioning and route mounting remain separate work.

Frozen v1.8.2 contract 2f04aa559682ad443d55fd12ca69442191866e283b1b588687a196d595b3942f, vectors 32ff8be13e0ad5e2861ecf2924dddcde031b47bc340d860dfb951cb8a97c5c61, plus v1.8.3 contract 67149b0dab25b385f8846d3d0beb350840e69c52e1bea5e4af93c1173b154051, vectors 29f14c5112ea6fc2850a08d362f3701b78029384b2ed5b31ad2d577b4f00df8c, add durable review resumption, fresh all-host zero without a decision, and the protected seven-day deadline event with immutable per-owner/host/target children. Original authenticated requests bind every required owner HMAC and frozen host. Only ledger-derived pending targets receive deadline children; changed, late, expired or revoked authority cannot be silently replaced. No kept state or partial completion is introduced.

Retirement snapshots must capture exact outside dependent identities in the retirement fence transaction, with raw identities only in the node database and secret domain-separated commitments in the authenticated ledger. The narrow encryption read exception requires current normal authorization, authoritative outside-reader classification and authenticated snapshot membership. Owner retirement still blocks writes, grants, shares and membership; exact resource purge fences block the exception. Raw snapshots are deleted in target completion, including destroyed named keys under a network. This snapshot/read integration remains incomplete; no positive exception is enabled by a parsed snapshot alone.

Delegation writes on fenced targets are refused without storage: a non-owner's full response equals a genuine revoked-chain refusal on the same path, including a never-hosted target under a retired owner. Direct-owner requests receive 410. Ordinary reads/invocations retain the never-created twin-world baseline.