Skip to content
GitHub

Signed Manifests and Provenance

Unaudited

Every stored asset carries a client-signed manifest, and its manifests form an append-only, hash-chained provenance log. This separates legitimate writes from malicious or buggy ones after the fact and defeats stale revival (Damage Scenarios and Quarantine — Damage Scenario → Invariant Map).

Structs live in capsule-core/src/crypto/provenance/. Verification is the verify_asset chokepoint (Key Management — Write Authorization). The server-signed counterpart is the custody receipt (Durability — Custody Receipts).

A signed manifest, not a Merkle tree: STREAM (Asset and Metadata Encryption — STREAM Construction) already catches chunk tampering, truncation and reordering. Load-bearing fields:

Field Rule
crypto_suite_id, protocol_version Signed suite (Cryptographic Primitives — Versioning Identifiers) and album protocol pin; not downgradable.
file_id, album_id, amk_version amk_version selects the epoch whose write-tier key verifies write_sig.
ciphertext_hash Content address of the original blob, header included (Asset and Metadata Encryption — Content Address), hashed while streaming.
key_commitment The original blob’s key commitment, mirrored from its header (Asset and Metadata Encryption — Key Commitment). Present wherever ciphertext_hash is.
metadata_blob_hash, metadata_key_commitment Content address and key commitment of the encrypted metadata blob (Asset and Metadata Encryption — Metadata Encryption). Present on create, replace, metadata-update only, and always together.
plaintext_size, chunk_size, nonce_prefix STREAM parameters; nonce_prefix is random per file and equals the blob header’s.
key_mode, wrapped_file_key derived (default) or wrapped (key sealed under the AMK). See below.
created_by_user, created_by_device The signer of this record; the creator is the create record’s signer.
client_version Exact build (Client Build Identification); audit-only.
timestamp Self-asserted; audit-only.
action Closed set owned by Authorization — The Closed Action Set.
prior_provenance_hash SHA-256 of the previous manifest. Null only on create, else rejected by client and server.
retention_until Set only on delete (retention window: Asset Organization — Retention Window).
device_sig, write_sig Hybrid Ed25519 + ML-DSA-65 over all fields. Both, and both halves, must verify.

device_sig proves provenance: it is by the uploading DSK (Key Management — Device Keys), chained to the user IK via the device directory (Key Management — Device Directory). write_sig proves write authority at amk_version: it is by the epoch’s write-tier key (Key Management — Album Master Keys (AMKs)).

Wire presence rules (normative). Present-null and absent keys sign differently:

  • prior_provenance_hash and retention_until encode as present null when unset.
  • metadata_blob_hash, metadata_key_commitment, key_mode, wrapped_file_key, upgraded_from, and the DerivativeManifest’s amk_version and protocol_version encode as absent keys when unset. Absent key_mode means derived; writing it explicitly breaks verification.
  • A key the reader does not know is kept verbatim, re-emitted canonically beside the known keys, and covered by both signatures (invariant 2 of Versioning — System Invariants). A newer writer’s manifest that only adds a field verifies on an older reader; stripping the field fails verification.

client_version and generated_by_client pin a write to its exact build:

client_version = client_id "/" semver "+" commit [".dirty"]
client_id capsule-ios | capsule-android | capsule-web | capsule-cli | <out-of-repo client id>
commit git hash of the client's own tree (full, or a prefix of at least 12 hex chars)

Example: capsule-ios/1.4.2+9f3a1c7d2b4e, and nothing else (no OS or model). It is audit-only: the server enforces only the size bound (Schema Rules and Open Questions). Parser: capsule-core/src/client_build.rs.

Every data or metadata change appends a record anchored by its manifest (Asset Manifest).

ProvenanceRecord { version, asset_id, manifest, prior_provenance_hash }. version is an integer (currently 1) that sorts first in canonical CBOR and is decoded before anything else. A record of a version the reader does not implement is quarantined and kept, never applied or dropped (invariants 3 and 5 of Versioning — System Invariants). The record’s hash mirrors the manifest’s, so the link is signed, and the match is a checked invariant: a record whose copies differ is rejected. Rewriting any past record breaks the forward walk from create.

Clients cache the verified head (O(1) steady state). Full walks run on first fetch, restore, or suspected tamper. A signed checkpoint record is the designated v2 extension. The server’s compaction of superseded provenance depends on it (Server Filesystem — Uniform, Opaque Blobs), so until it is defined (Known Gaps) a superseded record is released only by a purge.

What an Attacker With All Current Keys Still Cannot Do

Section titled “What an Attacker With All Current Keys Still Cannot Do”

An attacker holding every current DSK, AMK and write-tier key can append. It cannot rewrite a past record, which needs the earlier device’s hybrid signature, verifiable via the device directory (Key Management — Device Directory). It cannot remove one, because successors carry its hash. History is read-only.

Older clients copied created_by_* from the chain head into continuations while signing with the current device. Such records from a second device of the account never verify, and they exist in stored libraries.

Quarantine in place, with a distinct signal. No re-signing, which would rewrite history, and no accept-with-gap, which would trust an unverifiable field. The chain stalls: later records fail as ForgedChain and the asset stays at its last verified state.

A BadDeviceSig becomes LegacyInheritedDevice { named_device, signing_device, record_hash } only when all of these hold, which is unreachable without an account device key:

  1. the record is a continuation;
  2. device_sig verifies under a different device of the same directory, listed in the directory version the record is checked against; no timestamp is compared with added_at (invariant 7 of Validation Invariants — Server-Side Validation Invariants);
  3. every other check passes (epoch attested, write_sig, chain link).

record_hash lets later ForgedChain verdicts be filed under the stall rather than as an attack. Reporting changes; acceptance does not. A shared-album member’s write cannot meet (2) and stays Rejected(BadDeviceSig). There is no migration.

  • Client: append-only media/{YYYY}/{YYYY-MM}/{uuid}.provenance.cbor, kept as a tombstone after hard-delete. It is a non-authoritative cache, rebuilt from the server on mismatch.
  • Server: the append-only envelope sequence, served unchanged. The server reads prior_provenance_hash, action and retention_until to enforce chain advance and the purge floor keylessly (Validation Invariants — Server-Side Validation Invariants).

No API overwrites or deletes an entry: the action set (Authorization — The Closed Action Set) has no such action and invariant 17 (Validation Invariants — In the index critical section (every manifest write, upload or lifecycle)) refuses non-advancing writes.

Derivatives are signed so no client can silently overwrite another’s. DerivativeManifest differs from AssetManifest in:

  • source_asset_id;
  • role, a closed set: thumbnail | preview | embedding (LQIP lives in the signed sidecar instead);
  • format, closed, where the sentinel original means the tier is the original (no blob);
  • generated_by_*, generated_at, and model_id/model_version (embeddings);
  • amk_version and protocol_version, required on every real write (absent only in legacy fixtures);
  • key_commitment of the derivative blob, present exactly when the tier has a blob;
  • prior_provenance_hash, chained per (asset_id, role);
  • device_sig and write_sig, under the same rules as the asset manifest.

It travels as the derivative_manifest blob, served verbatim. Only it carries the nonce_prefix and amk_version that open the derivative. An overwrite is a derivative-replace on the role’s chain. verify_derivative checks both signatures, source_asset_id and the chain link. The receiver walks each role’s chain from its start. A refused or forked link stops the walk: the prefix is accepted and the rest quarantined and surfaced, never applied.

Failure Detected / contained by Recovery
Stale revival (an old, valid manifest re-served) prior_provenance_hash chain, client and server (Validation Invariants) Quarantine; chain advance refused
Suite downgrade Both signatures cover crypto_suite_id and protocol_version Quarantine
Derivative poisoning DerivativeManifest chain (Derivative Provenance) Unsigned overwrite rejected; existing derivative kept
Blob header disagrees with its manifest Keyless header check at finalize and on read (Asset and Metadata Encryption — Header and Manifest Agreement) Refused at upload; sealed bad at source on read
  • The checkpoint record has no format. Server Filesystem — Uniform, Opaque Blobs releases superseded records against it, so until these are fixed no superseded record is compacted:
    • Form. Whether it is a new action in the closed set (Authorization — The Closed Action Set) or a new ProvenanceRecord version, and how a reader that does not implement it keeps it quarantined without stalling the chain.
    • What it attests. The hash and chain position of the record it covers, plus the state a device that first sees the asset needs without the walk: the create record’s signer and timestamp, the newest metadata_blob_hash and metadata_key_commitment, the original’s ciphertext_hash and key_commitment, and any open retention_until.
    • Signer. Which devices may sign it (any authorized writer, or only the asset owner’s devices), and the amk_version whose write-tier key signs write_sig. This bounds the one new power it grants: an attacker holding current keys could otherwise make the server release history that What an Attacker With All Current Keys Still Cannot Do says it cannot remove.
    • Checks. The rule a reader applies in place of the walk, and the server’s keyless checks (the covered record is in the chain, and no delete at or before it has an open retention window), which Validation Invariants must state as an invariant.

Negative cases map to the Damage Scenarios and Quarantine — Damage Scenario → Invariant Map.

  • verify_asset: fixed positive vectors, and one negative fixture each for reader-signed, retired epoch, wrong epoch, forged cert chain (an unknown device, or one not yet listed in the directory version in force at receipt, whatever its timestamp), replay and suite downgrade.
  • Wrapped key: tampering with key_mode or wrapped_file_key fails verification; a valid wrapped key unwraps and decrypts.
  • Commitment mirror: a manifest whose key_commitment or metadata_key_commitment differs from the blob header is refused by the server and classified by the client; metadata_key_commitment without metadata_blob_hash fails verification.
  • Chain advance: a wrong prior_provenance_hash is rejected by both client and server.
  • Append-only: dropped or rewritten records break the walk, the server refuses overwrite and delete, and a tampered cache is rebuilt.
  • Derivative poisoning: a derivative-replace that does not chain to the (asset_id, role) head is rejected and the existing derivative is kept.
  • Client build: producers emit the grammar with a real commit; arbitrary strings still verify.
  • Byte-identical serving (smoke): every serving surface returns uploaded bytes; a server re-encode fails the signature.
  • All current keys: rewriting a past record is detected.

The cross-module upload→verify path is in the E2E case index.