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).
Asset Manifest
Section titled “Asset Manifest”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)).
- Physical placement. The manifest is never embedded in ciphertext. It is the bundle’s envelope object: server-visible canonical CBOR (no secrets) uploaded under the
provenanceblob role (Upload — What Gets Uploaded) and stored verbatim, which makes the index rebuildable without PostgreSQL (Server Filesystem — Recovering the Index from Blobs Alone). The server also projects the fields it reads into PostgreSQL. Other blobs are referenced by hash only. - The signed bytes are the served bytes. No surface, whether the sync feed (Sync — Discovering What Changed), an index rebuild or Federation, may re-encode a manifest from the projection, because the projection holds no signature and signatures cover one exact encoding.
- The commitment mirror lets a manifest holder check its key before fetching a byte, and lets the server check each blob’s header against the manifest without a key (Asset and Metadata Encryption — Header and Manifest Agreement). It adds no trust: the header is already covered by
ciphertext_hash, so the mirror only moves the check earlier and makes a signer’s inconsistency attributable. - Rewrite re-rolls keys (Asset and Metadata Encryption — Re-keying on Rewrite). The signed
metadata_blob_hashbinds server metadata to the client’s sidecar (Metadata — Local and Server Metadata Equivalence). - Wrapped key mode exists only for an adopted web-upload drop (Web Upload — Why Adopt-in-Place). It is set on the adopting
create, never onreplace, and is authorization-neutral (Asset and Metadata Encryption — Asset Key Derivation).
Wire presence rules (normative). Present-null and absent keys sign differently:
prior_provenance_hashandretention_untilencode as presentnullwhen unset.metadata_blob_hash,metadata_key_commitment,key_mode,wrapped_file_key,upgraded_from, and theDerivativeManifest’samk_versionandprotocol_versionencode as absent keys when unset. Absentkey_modemeansderived; 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 Build Identification
Section titled “Client Build Identification”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.
Provenance of Library Modifications
Section titled “Provenance of Library Modifications”Every data or metadata change appends a record anchored by its manifest (Asset Manifest).
Chained, Append-Only Structure
Section titled “Chained, Append-Only Structure”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.
Legacy Inherited-Device Records
Section titled “Legacy Inherited-Device Records”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:
- the record is a continuation;
device_sigverifies under a different device of the same directory, listed in the directory version the record is checked against; notimestampis compared withadded_at(invariant 7 of Validation Invariants — Server-Side Validation Invariants);- 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.
Physical Storage
Section titled “Physical Storage”- 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,actionandretention_untilto 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.
Derivative Provenance
Section titled “Derivative Provenance”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 sentineloriginalmeans the tier is the original (no blob);generated_by_*,generated_at, andmodel_id/model_version(embeddings);amk_versionandprotocol_version, required on every real write (absent only in legacy fixtures);key_commitmentof the derivative blob, present exactly when the tier has a blob;prior_provenance_hash, chained per(asset_id, role);device_sigandwrite_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 Modes
Section titled “Failure Modes”| 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 |
Known Gaps
Section titled “Known Gaps”- 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
actionin the closed set (Authorization — The Closed Action Set) or a newProvenanceRecordversion, 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
createrecord’s signer andtimestamp, the newestmetadata_blob_hashandmetadata_key_commitment, the original’sciphertext_hashandkey_commitment, and any openretention_until. - Signer. Which devices may sign it (any authorized writer, or only the asset owner’s devices), and the
amk_versionwhose write-tier key signswrite_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
deleteat or before it has an open retention window), which Validation Invariants must state as an invariant.
- Form. Whether it is a new
Validation
Section titled “Validation”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 itstimestamp), replay and suite downgrade.- Wrapped key: tampering with
key_modeorwrapped_file_keyfails verification; a valid wrapped key unwraps and decrypts. - Commitment mirror: a manifest whose
key_commitmentormetadata_key_commitmentdiffers from the blob header is refused by the server and classified by the client;metadata_key_commitmentwithoutmetadata_blob_hashfails verification. - Chain advance: a wrong
prior_provenance_hashis 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-replacethat 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.