Docs: mine Xous' PDDB for the Vault design
Vaults are specified but almost entirely unbuilt, so this is the cheap moment to read the closest prior art. docs/vault-pddb-research.md is the comparison: what transfers (the union view and its write-target rule, enumerate-vs-unlock, key commitment, an offline store reader), what does not (a noise-filled fixed container, make-before-break journaling, device-bound AAD, a per-device pepper), and the pitfalls — most of which bite harder here than they did on a single 100MiB device, because an ensemble manufactures the disk snapshots that deniable storage cannot survive. Its conclusion is that a locked vault and a hidden one are different products and only the first is reachable, so TODO.md now carries the work that implies and docs/long-term-todo.md carries the hidden vault, its trigger, and the three storage rules it would have to be built under.
This commit is contained in:
1 parent
15b0db7a9d
commit
9c083f61cc
3 files changed
+602
-5
No files matched your search
@@ -22,11 +22,38 @@ done now — sound idea, decision already taken to defer it — lives in
|
||||
and the triggers that would reopen it. Build the derivation when something needs it,
|
||||
not before.
|
||||
|
||||
#### Consider ideas from Plausibly Deniable DataBase
|
||||
- https://betrusted.io/xous-book/ch09-00-pddb-overview.html
|
||||
- this experimental OS project introduces a PDDB concept that has some similarities to Vaults; I want
|
||||
to make sure that I'm borrowing as many good ideas, potential security pitfalls to avoid, etc. from
|
||||
this project
|
||||
#### Act on the PDDB comparison for Vaults
|
||||
- **Description**: Xous' Plausibly Deniable DataBase has been mined for ideas and
|
||||
pitfalls; the findings and the reasoning are in `docs/vault-pddb-research.md`.
|
||||
Its headline conclusion is that a locked vault and a *hidden* one are different
|
||||
products, and that sync makes the hidden one close to unreachable — so vaults
|
||||
should be locked-but-visible, said so on purpose. What remains is the work that
|
||||
conclusion implies, all of it cheapest now, before a second vault exists.
|
||||
- **Decide and write down** (`docs/vault-pddb-research.md` §7): that vaults conceal
|
||||
content and not existence, in `docs/data-model.md`; which vault a new document
|
||||
lands in, since `Document::new` currently assigns `DEFAULT_VAULT_ID` itself and
|
||||
has no parameter; and whether a `Passphrase` vault stores its own salt, which is
|
||||
the choice that forecloses deniability for that variant.
|
||||
- **Build**:
|
||||
- A locked vault as a *state*, alongside `DocumentAvailability`'s three, reached
|
||||
before render rather than as a `VaultKeyNotFound` at decrypt time — otherwise a
|
||||
sealed document renders as fully present and then blanks, which is the bug
|
||||
"Absence is not an error" exists to prevent. Words in a `copy::vault` module.
|
||||
- Vault-awareness in `eviction.rs`, `content_ledger.rs` and the last-copy guard.
|
||||
This one is data loss, not disclosure: both are vault-blind today, so eviction
|
||||
would happily delete the only copy of a blob nobody present can read.
|
||||
- Pin system-written documents (agent settings, ADR 0018, and anything else the
|
||||
system writes rather than the user) to the default vault at the type level.
|
||||
The PDDB shipped the bug where a setting written while a secret vault was open
|
||||
silently reverts when it is locked.
|
||||
- Property and Artifact `value` encryption under the vault key, which is the only
|
||||
part of the boundary `docs/document-sync.md` claims and the code does not have.
|
||||
- Bind `vault_id` as AAD in `vault::encrypt_vault_key`/`decrypt_vault_key`; they
|
||||
seal with `b""` today, alone among this codebase's AEAD call sites.
|
||||
- **Also worth having**: an offline store verifier that walks documents → artifacts
|
||||
→ blob files and opens every sealed chunk, on the model of the PDDB's
|
||||
`backalyzer.py`. Useful before vaults, and the only way to answer "what in this
|
||||
store can I still open?" once blobs live under more than one key.
|
||||
|
||||
#### Design a robust manifold key rotation scheme
|
||||
- **Description**: No mechanism exists for rotating the manifold (master) keypair if it is
|
||||
|
||||
@@ -78,6 +78,49 @@ case. And note what a password can never buy: code running as the node's own
|
||||
user is inside the boundary either way, because the daemon has to hold the
|
||||
unwrapped key to run at all. ADR 0052 has that argument in full.
|
||||
|
||||
## A genuinely hidden vault, as its own key spec
|
||||
|
||||
**What.** A vault whose *existence* an adversary with a forensic image of a node
|
||||
cannot establish — Xous' PDDB Basis, rather than the locked-but-visible vault
|
||||
`docs/data-model.md` specifies. `docs/vault-pddb-research.md` is the full
|
||||
comparison; this entry records the decision it argues for.
|
||||
|
||||
**Why it is not being done now.** Two reasons, and the second is the hard one.
|
||||
|
||||
It is a different product from a locked vault, not a stronger setting on one. A
|
||||
hidden vault can keep no record of itself anywhere: no row in `vault_keys`, no
|
||||
name, and in particular **no stored salt**, because a per-vault salt is exactly
|
||||
the record that betrays the vault. The PDDB derives its salt from the vault name
|
||||
and password against one global salt block for precisely this reason, and pays
|
||||
for it with the property that a forgotten name is unrecoverable data loss
|
||||
indistinguishable from a wrong password. So it needs its own `VaultKeySpec`
|
||||
variant with its own storage rules, and cannot be a flag on `Passphrase`.
|
||||
|
||||
And sync is close to fatal to the idea. The deniable-storage literature's
|
||||
adversary hierarchy runs single-snapshot → multi-snapshot → online, and the PDDB
|
||||
only claims the first; its own book concedes that repeated disk images erode
|
||||
deniability toward zero. An ensemble manufactures snapshots: every peer keeps a
|
||||
catalog row carrying `vault_id` for every document, a revoked node keeps a dated
|
||||
copy of everything it had, convergent encryption makes blob ciphertext
|
||||
deterministic so two images of the blob store diff perfectly, and sync traffic
|
||||
is itself an online side channel. Hiding a vault would mean it does not sync, or
|
||||
syncs on a plane that puts nothing about it in a record every peer keeps — a
|
||||
protocol redesign rather than a feature.
|
||||
|
||||
Against that, the threat a locked vault already answers — the device is unlocked
|
||||
and in someone else's hands — is the one `docs/data-model.md` actually names, and
|
||||
a `Passphrase` vault answers it completely.
|
||||
|
||||
**What would make it worth doing.** The threat model gaining compelled
|
||||
disclosure: a node expected to be seized and imaged, with the user expected to
|
||||
be made to unlock it. That is a different user than "my phone was taken off me
|
||||
at a bar", and it is worth waiting for a real one rather than guessing.
|
||||
|
||||
**If it is ever built, three rules are not negotiable**, and they are why the
|
||||
decision has to be taken before a hidden vault is written rather than after: no
|
||||
per-vault record on disk of any kind; one global salt block that exists whether
|
||||
or not a hidden vault does; and a sync story of its own, or none.
|
||||
|
||||
## Build a user-editable color theming system for gui-app
|
||||
- **Description**: `rust/gui-app/src/theme.rs` now defines the role tokens (surfaces,
|
||||
text, accent, semantic status colors) and resolves them for light/dark from a
|
||||
|
||||
@@ -0,0 +1,527 @@
|
||||
# Vaults and the PDDB: what a plausibly deniable database has to teach
|
||||
|
||||
Research notes mining Xous' **Plausibly Deniable DataBase** (PDDB) for the Vault
|
||||
design, which is specified in `docs/data-model.md` but almost entirely unbuilt.
|
||||
The PDDB is the closest prior art this project has: a small team of experienced
|
||||
engineers spent a lot of effort on "one store, several keying domains, one of
|
||||
which the user can lock" and wrote down both the mechanism and the ways it
|
||||
leaks. Sources are listed at the end; the primary one is the Xous book,
|
||||
chapter 9.
|
||||
|
||||
This document is research plus a recommendation. It does not commit to an
|
||||
implementation. §7 is what it argues should be decided now, while nothing
|
||||
constructs a second vault and every schema choice is still free.
|
||||
|
||||
---
|
||||
|
||||
## 1. The distinction that governs the whole comparison
|
||||
|
||||
The PDDB and Vaults look alike and are aimed at different threats.
|
||||
|
||||
- **Confidentiality** is: an adversary cannot read the data. A locked vault
|
||||
gives this. The lock is visible; the adversary knows there is something they
|
||||
cannot read.
|
||||
- **Deniability** is: an adversary cannot establish that the data *exists*.
|
||||
This is a much stronger claim, and every part of the PDDB's architecture —
|
||||
the bespoke page table, the noise-filled backing store, the free-space cache,
|
||||
the refusal to store a salt — exists to buy it.
|
||||
|
||||
`docs/data-model.md` describes the `Passphrase` vault as covering "the
|
||||
cop-with-open-phone scenario". That is a **confidentiality** threat: the device
|
||||
is unlocked and in someone else's hands, and the secrets vault stays shut
|
||||
because its key was never stored. A `Passphrase` vault as specified already
|
||||
solves it, completely, and needs no deniability at all.
|
||||
|
||||
The PDDB targets a different scene: the device is seized and imaged, the boot
|
||||
PIN is compelled, and the question is whether the forensic image proves a second
|
||||
Basis exists. Nothing in the current Vault design addresses that, and §5 and §6
|
||||
argue that reaching for it in a syncing ensemble would cost far more than it did
|
||||
for a single device with 100 MiB of raw FLASH.
|
||||
|
||||
So the value of this exercise is not "how do we get deniability". It is:
|
||||
the PDDB is a locked-domain design that was pushed all the way to its limits by
|
||||
people who then wrote down where it breaks. Most of what breaks it breaks
|
||||
locked domains too.
|
||||
|
||||
---
|
||||
|
||||
## 2. Where vaults are today
|
||||
|
||||
| Piece | State |
|
||||
| --- | --- |
|
||||
| `VaultId` on every Document, Artifact, BlobRef | **Built** (`vault::VaultId`) |
|
||||
| `VaultStore` — encrypted vault keys in SQLite | **Built** (`stores/vault.rs`), one row per vault: `(vault_id, nonce, ciphertext, updated_at)` |
|
||||
| Default vault key, `EnsembleDerived` via HKDF, wrapped under the node key | **Built** (`vault::derive_ensemble_vault_key`, `encrypt_vault_key`; set up in `ensemble/init.rs`) |
|
||||
| Blob content encryption, convergent, chunked AEAD | **Built** (`vault::BlobSealer`, ADR 0028) |
|
||||
| Downstream key domains derived from the vault key | **Built** — `derive_blob_content_key`, `NameKey::from_vault_key` (`p2p/sealed_name.rs`), `credentials.rs` |
|
||||
| Property and Artifact **value** encryption | **Not built.** The columns are `BLOB` so it can be added without migration (`stores/document.rs:223`, `stores/artifact.rs:87`), and that is all |
|
||||
| A second vault of any kind | **Not built.** Nothing constructs `VaultKeySpec::Passphrase`; `SharedKey` is a reserved name with no body |
|
||||
| Persistence for a `Vault` descriptor (`name`, `key_spec`) | **Does not exist.** `default_vault()` is a function that returns a constant. There is no table for a vault's name or its `KdfParams` |
|
||||
| Vault key exchange between nodes | **Not built** (`docs/document-sync.md` §Vault identity calls it future work) |
|
||||
| Vault lock/unlock as a runtime state | **Does not exist.** `blob_store::vault_key` resolves a key by id or returns `VaultKeyNotFound`; there is no locked state, only a missing key |
|
||||
| Any UI on any modality | **None** |
|
||||
|
||||
Three claims in the docs are ahead of the code, and matter for what follows:
|
||||
|
||||
- `docs/document-sync.md` §Vault identity says a receiving node "cannot decrypt
|
||||
the content without the vault key". True for blob *bytes* only.
|
||||
`PropertyRecord.value` (`p2p/doc_sync.rs:350`) is MessagePack plaintext on
|
||||
the wire and plaintext in SQLite at both ends. So today the vault boundary is
|
||||
enforced for blobs and for nothing else.
|
||||
- `SyncScope` (`stores/document.rs:2810`) has no vault predicate. Every
|
||||
document row syncs to every admitted node, `vault_id` and all.
|
||||
- `docs/data-model.md` says property/artifact/blob encryption "is the remaining
|
||||
step". Blobs are done; the sentence should now name only the other two.
|
||||
|
||||
---
|
||||
|
||||
## 3. How the PDDB works, in the parts that are load-bearing
|
||||
|
||||
A **Basis** is a named, password-protected overlay. The user's view is the union
|
||||
of all unlocked Bases; a name collision resolves to the most recently unlocked
|
||||
one; the API can always name a Basis explicitly. `.System` is created at format
|
||||
time, is always mounted, and its presence is what "mounted" means.
|
||||
|
||||
Four mechanisms do the work:
|
||||
|
||||
1. **Orthogonal page tables.** Every Basis has an identical 64-bit virtual
|
||||
address space, and all of them share one physical page table. Entries are
|
||||
128-bit AES-ECB blocks holding a virtual page number, flags, a 32-bit nonce
|
||||
and a 32-bit murmur3 checksum. Bases do not collide because each Basis
|
||||
encrypts its entries under a different key. Mounting means trial-decrypting
|
||||
every page-table block (~25,000 of them) and keeping the ones whose checksum
|
||||
passes — a cheap filter, with the real authentication deferred to the
|
||||
AES-GCM-SIV MAC on the data page.
|
||||
2. **IND$-CPA everywhere.** Data pages are indistinguishable from random, and
|
||||
free space is pre-filled with CSPRNG noise. A locked Basis is bytes that look
|
||||
like unused space. This *is* the deniability.
|
||||
3. **No record of a Basis exists anywhere.** Not the name, not the password, not
|
||||
a hash, not a salt. A Basis key is derived from `name + password` hashed
|
||||
against a global `salt_base` — and the derived salt is a function of the
|
||||
secret material itself, because a stored per-Basis salt would be exactly the
|
||||
record that betrays the Basis. Lose the name or the password and the Basis is
|
||||
deleted, by construction.
|
||||
4. **The Free Space Cache (FSCB).** Knowing the true free space would reveal
|
||||
hidden data, so the system deliberately only ever knows *some* of it — by
|
||||
default about half, ±10% of TRNG fuzz, capped at ~7% of capacity. When it is
|
||||
exhausted, the user is asked to *enumerate* every secret Basis so free space
|
||||
can be recomputed; a Basis not presented at that moment can have its pages
|
||||
handed out and its data destroyed.
|
||||
|
||||
Two vocabulary items are worth keeping: **enumerate** (prove you know the Basis
|
||||
so its used pages can be counted, then zeroize the keys) versus **unlock**
|
||||
(mount it, cache the keys, put it in the union view). They are different
|
||||
operations with different costs and different disclosures.
|
||||
|
||||
---
|
||||
|
||||
## 4. Ideas worth taking
|
||||
|
||||
### A. The union view, and the rule for where a write lands
|
||||
|
||||
The PDDB's most transferable idea is not a mechanism, it is a set of view
|
||||
semantics, stated up front:
|
||||
|
||||
> reads come from the union, most-recently-unlocked wins; writes go to the
|
||||
> most-recently-unlocked Basis that has the key, else create there; the API can
|
||||
> always name a Basis explicitly.
|
||||
|
||||
Synchronicity gets the read half nearly free — a document whose vault is locked
|
||||
simply is not in the result set — but **has no answer at all for the write
|
||||
half**. Nothing in the code or the docs says which vault a newly created
|
||||
document lands in, because nothing can yet put one anywhere but the default:
|
||||
`Document::new` (`documents/document.rs:440`) takes a type, a parent and an
|
||||
origin node, and assigns `vault_id: DEFAULT_VAULT_ID` itself. The parameter has
|
||||
to be introduced, and the moment it is, every call site becomes a policy
|
||||
decision.
|
||||
|
||||
Take the PDDB's default (most recently unlocked, overridable), and take its
|
||||
warning with it, because the project has the exact hazard bunnie flags:
|
||||
|
||||
> Administrative operations, especially ones that deal with non-sensitive
|
||||
> settings, should generally specify the system basis explicitly so that options
|
||||
> don't mysteriously reset or disappear when secret Bases are mounted or
|
||||
> unmounted.
|
||||
|
||||
Agent settings are documents here (ADR 0018). Under a most-recently-unlocked
|
||||
default, changing a setting while the secrets vault is open writes the setting
|
||||
*into the secrets vault*, and locking it reverts the setting with no explanation.
|
||||
That is a bug the PDDB shipped, wrote down, and worked around by convention.
|
||||
The better fix is that the settings document's vault is pinned to the default at
|
||||
the type level, not left to each agent to remember.
|
||||
|
||||
The same test applies to anything else the system writes on the user's behalf
|
||||
rather than at their direction: jobs, sync policy, peer health, provenance.
|
||||
|
||||
### B. Enumerate vs. unlock — and the state the UI is missing
|
||||
|
||||
Synchronicity already refuses to conflate "the bytes are elsewhere" with "there
|
||||
are no bytes": `DocumentAvailability` is `Local` / `Remote` / `Nowhere`
|
||||
(`documents/availability.rs`), and the "Absence is not an error" principle
|
||||
exists because rendering an empty buffer for text that demonstrably exists
|
||||
invites the user to retype it and fork the document.
|
||||
|
||||
A locked vault introduces a *fourth* condition that is orthogonal to all three:
|
||||
**the bytes are right here and cannot be read.** If it is left to fall out as a
|
||||
`VaultKeyNotFound` at decrypt time, the document will render as `Local` —
|
||||
everything present — and then produce an error or a blank at the moment of
|
||||
opening. That is precisely the failure the principle forbids, arriving through a
|
||||
new door.
|
||||
|
||||
So: a locked vault needs its own state, named in the type system and rendered
|
||||
deliberately, with its words in `copy.rs` (a `copy::vault` module) rather than
|
||||
invented per screen. The PDDB's enumerate/unlock split is also worth keeping as
|
||||
vocabulary even without an FSCB, because the same two operations exist here:
|
||||
*prove you can open this vault so its size can be counted* is not the same act
|
||||
as *open it and put its documents in the view*.
|
||||
|
||||
### C. A stored per-vault salt is a stored per-vault record
|
||||
|
||||
This is the single most valuable thing to take from the PDDB, and it is a schema
|
||||
decision that is free today and expensive later.
|
||||
|
||||
`VaultKeySpec::Passphrase { kdf_params: KdfParams { salt, m_cost, t_cost,
|
||||
p_cost } }` implies persisting, per vault, a random salt and a set of Argon2
|
||||
parameters. `VaultStore` already has a row per vault. Persist a second vault at
|
||||
all — its name, its salt, even just its id — and the store now contains a
|
||||
positive record that a second vault exists. Every node that holds the store
|
||||
holds that record.
|
||||
|
||||
The PDDB will not do this. It derives the salt from `name + password +
|
||||
salt_base`, where `salt_base` is one global block of TRNG bytes that exists
|
||||
whether or not any secret Basis does. The cost is real and is accepted: a
|
||||
mistyped name is indistinguishable from a wrong password, and a forgotten name
|
||||
is unrecoverable data loss with no error message to tell you so.
|
||||
|
||||
Two conclusions, and they are different:
|
||||
|
||||
- **If vaults are locked-but-visible** (the recommendation in §7), storing the
|
||||
salt is correct, and the UX is enormously better for it: locked vaults can be
|
||||
listed, named, and offered for unlock. Say so on purpose rather than by
|
||||
default.
|
||||
- **If a hidden vault is ever wanted**, it cannot reuse this shape at all. It
|
||||
needs a global salt block, no row of its own anywhere, and a name that is part
|
||||
of the key derivation. That makes it a distinct `VaultKeySpec` variant with
|
||||
distinct storage rules, not a flag on `Passphrase`.
|
||||
|
||||
### D. Deriving several keys from one, with domain separation
|
||||
|
||||
The PDDB derives two keys per Basis — a page-table key and a data key — from
|
||||
one password, via HKDF-SHA256 with different `info` strings. This project
|
||||
already does the same thing, and does it in more places and more cleanly:
|
||||
`derive_ensemble_vault_key` → `derive_blob_content_key`,
|
||||
`NameKey::from_vault_key`, each with its own context string, each documented as
|
||||
to why the domains are kept apart. No change needed; recorded as convergent
|
||||
evidence that the pattern is right.
|
||||
|
||||
### E. Key commitment, and what "the passphrase was wrong" will mean
|
||||
|
||||
The PDDB was bitten here. AES-GCM-SIV is not key-committing (the "Salamanders"
|
||||
result): a crafted ciphertext can open validly under two different keys. The fix
|
||||
was a hand-rolled key commitment in each Basis' root page, which the book flags
|
||||
as hand-rolled because no blessed standard existed.
|
||||
|
||||
ChaCha20-Poly1305 has the same non-committing property, so the same care applies
|
||||
the moment there is a passphrase to check. Today nothing trial-decrypts — a
|
||||
vault key is looked up by id — so the exposure is nil. It arrives with the first
|
||||
`Passphrase` vault, because "did the user type the right passphrase?" has to be
|
||||
answered somehow, and the obvious implementation is to try opening something and
|
||||
see.
|
||||
|
||||
What matters when writing that:
|
||||
|
||||
- **The verifier must not be a stored hash of the passphrase**, for §4C's
|
||||
reason.
|
||||
- **A failed unlock must be indistinguishable from a wrong vault name**, if
|
||||
hidden vaults are ever in scope; if they are not, a clear error is better.
|
||||
- **Whatever ciphertext is used as the verifier must be one the user's own node
|
||||
wrote**, so a non-committing AEAD cannot be exploited by an attacker-chosen
|
||||
blob. A committing construction (an explicit key-commitment tag) is the
|
||||
belt-and-braces answer and is cheap to add to a format that does not exist
|
||||
yet.
|
||||
|
||||
### F. Bind the vault id into the key wrap (small, concrete)
|
||||
|
||||
`encrypt_vault_key`/`decrypt_vault_key` (`vault/mod.rs`) seal with empty AAD:
|
||||
|
||||
```rust
|
||||
cipher.encrypt_in_place(nonce, b"", &mut buf)
|
||||
```
|
||||
|
||||
The `vault_id` is the row's primary key and is not bound to the ciphertext, so
|
||||
a wrapped key is portable between rows. The threat is small — writing
|
||||
`store.db` means owning the node — but the codebase's own standard is stricter
|
||||
than this everywhere else it seals something: blob chunks bind
|
||||
`plaintext_hash || chunk_index` as AAD specifically so a chunk cannot be
|
||||
spliced elsewhere, and `sealed_name` binds the node pubkey so a name cannot be
|
||||
lifted onto another member's announcement. Passing `vault_id.as_uuid()
|
||||
.as_bytes()` as AAD makes a misfiled key fail loudly instead of unwrapping into
|
||||
the wrong vault. It invalidates existing `vault_keys` rows, which the project's
|
||||
status makes acceptable.
|
||||
|
||||
### G. An offline reader for the store
|
||||
|
||||
`backalyzer.py` takes a PDDB backup image plus the keys, decrypts it, walks
|
||||
every Basis/dictionary/key, checks consistency, and can dump everything. It is
|
||||
presented as a backup tool; its more interesting properties are that it is a
|
||||
**consistency checker** and a **recovery path that does not need the device**.
|
||||
|
||||
Synchronicity has neither. `ensemble/reseed.rs` moves a store into a new
|
||||
ensemble, which is a different job. A `syn store verify` that walks documents →
|
||||
artifacts → blob files, opens every sealed chunk, and reports what does not
|
||||
reconcile would be worth having independently of vaults — and once blobs live
|
||||
under several keys, it is the only way to answer "what in this store can I still
|
||||
open?" The PDDB's own warning applies to the recovery half: such a tool is
|
||||
handed every key at once, so it belongs on a trusted machine and its
|
||||
documentation should say so.
|
||||
|
||||
---
|
||||
|
||||
## 5. What does not transfer, and why
|
||||
|
||||
Worth writing down so nobody re-derives these.
|
||||
|
||||
- **Noise-filled backing store.** The PDDB owns a fixed 100 MiB FLASH region
|
||||
and pre-fills it with CSPRNG output. Synchronicity is a SQLite file plus a
|
||||
git-style sharded directory of blob files on someone's ordinary filesystem.
|
||||
There is no "free space" to be indistinguishable from — there are directory
|
||||
entries, file sizes, mtimes, and a database with a row per document. Getting
|
||||
the PDDB's core property would mean a fixed-size container file, i.e. a
|
||||
different storage engine.
|
||||
- **Make-before-break journaling.** Ten pages of FLASH and a bespoke protocol
|
||||
to survive power loss during a page-table update. SQLite gives this away.
|
||||
Worth noticing how much of the PDDB's complexity is paid for a durability
|
||||
guarantee this project gets for free; the only analogous exposure here is
|
||||
blob files living outside the transaction, which `TempBlob`'s
|
||||
write-temp-then-rename already covers.
|
||||
- **Device-DNA in the AAD.** The PDDB binds each page's AAD to the FPGA's
|
||||
silicon serial so a raw copy to another device is inert. Synchronicity must
|
||||
do the *opposite*: the whole point is that a vault opens on every node. Binding
|
||||
anything node-specific into content AEAD would break sync. (The `version` half
|
||||
of their AAD is already covered here, since the rotation counter feeds the key
|
||||
derivation, so an old key simply fails to open new data.)
|
||||
- **bcrypt with work factor 7.** A concession to a single-issue in-order 100 MHz
|
||||
RV32 core, and it drags in bcrypt's 72-byte password truncation, which surfaces
|
||||
in the PDDB's API as a documented password length limit. Argon2id — already a
|
||||
dependency, already the plan in TODO.md — has neither problem. Do not copy the
|
||||
parameters or the limit.
|
||||
- **The per-device pepper.** The PDDB mixes in a pepper from the key ROM so
|
||||
brute-force tables cannot be reused across devices. It works because the
|
||||
pepper lives somewhere an attacker with a disk image does not reach (it takes
|
||||
JTAG). Synchronicity has no such enclave, so a pepper in the store is just a
|
||||
salt under another name, and a per-vault random salt already provides
|
||||
the cross-target property. The idea does not transfer *unless* a hardware root
|
||||
of trust does.
|
||||
- **The FSCB itself.** Its purpose is to lie about free space. With no fixed
|
||||
container there is no free space to lie about. Its *lesson* transfers and is
|
||||
in §6.
|
||||
|
||||
---
|
||||
|
||||
## 6. Pitfalls, most of which bite harder here
|
||||
|
||||
### 6.1 API leakage — and this project's version of it
|
||||
|
||||
The book's frankest section: a deniability-naive application defeats the whole
|
||||
system by keeping a path to a secret file in a non-secret place. Their example
|
||||
is a dangling contact reference that throws an error, which betrays the contact.
|
||||
Their rule of thumb is that applications must treat the store as the
|
||||
authoritative index and stop caching listings — "unlearn the pattern of creating
|
||||
local copies of directory listings", and re-query every time a view is rebuilt.
|
||||
|
||||
Synchronicity's structure is *more* exposed than a filesystem's, because the
|
||||
things that link documents together are themselves first-class synced records:
|
||||
|
||||
| Surface | What it would leak about a locked vault |
|
||||
| --- | --- |
|
||||
| `documents/wikilinks.rs` | The `WikiLink` edge targets an id, deliberately, so it survives a rename — but the *body* of the linking note still contains the literal `[[Ada Lovelace]]`. The link text is the leak, it lives in the unlocked note, and it survives the target being locked. |
|
||||
| Edges (`stores/document.rs`'s `get_edges_from`, e.g. `EdgeKind::Attendee`) | An edge rides with its `from` document on the wire. A default-vault Human edged to a locked Interaction carries the target id in plaintext, on every node. |
|
||||
| `parent_id` | A locked child of an unlocked collection means the collection's children count and tree shape disagree with what is visible. |
|
||||
| Command palette / search (`docs/command-palette-and-search.md`) | Any persisted index built over unlocked content is a cache of exactly the kind bunnie says to stop keeping. |
|
||||
| Recents, "open recently", jobs | Same. A job record names what it worked on. |
|
||||
| Provenance (ADR 0038) | Records where a document came from, whether or not you can read it. |
|
||||
|
||||
None of this is hypothetical or far off — the edges and wikilinks exist and are
|
||||
synced today. The mitigation for a *locked* (not hidden) vault is modest and
|
||||
mostly about not producing errors: a link into a locked vault should render as
|
||||
locked, and a view should never fail because part of it is sealed. The
|
||||
mitigation for a hidden vault is that most of these records cannot exist across
|
||||
the boundary at all.
|
||||
|
||||
### 6.2 "Absence is not an error" and deniability point in opposite directions
|
||||
|
||||
The project's principle says that a document whose content is elsewhere is a
|
||||
state to *render*, clearly and specifically. Deniability requires that a locked
|
||||
vault's contents be indistinguishable from nothing at all. You cannot do both:
|
||||
rendering "this is in a locked vault" is a disclosure, and rendering nothing is
|
||||
the retype-and-fork bug.
|
||||
|
||||
This is a genuine, unavoidable fork, and it is a second reason to answer it in
|
||||
favor of locked-but-visible — the principle is load-bearing across every agent
|
||||
and every modality, and it was written first.
|
||||
|
||||
### 6.3 Accounting leaks — the FSCB lesson without the FSCB
|
||||
|
||||
The FSCB exists because *any accounting the system keeps about storage
|
||||
discloses what is stored*. That generalizes past free space, and Synchronicity
|
||||
has several accounts:
|
||||
|
||||
- `copy::ContentRowCopy::stored()` renders "N of M artifact(s) held (X of Y)"
|
||||
from `content_ledger::TypeLedger`. The ledger is entirely vault-blind — grep
|
||||
`content_ledger.rs` for `vault` and the only hits are in tests. A locked
|
||||
vault's blobs would be counted into both the numerator and the denominator.
|
||||
- `eviction.rs` is equally vault-blind. Two consequences, and the second is
|
||||
worse than a leak: eviction may **delete the only copy of a locked vault's
|
||||
blob**, and the last-copy guard (ADR 0013) may **name** a locked document
|
||||
while refusing to. The PDDB has the same failure — a Basis not presented
|
||||
during an FSCB refill can have its pages reallocated and its data destroyed —
|
||||
and it handles it by stopping and asking the user to enumerate every Basis.
|
||||
That is the shape of the answer here too: destructive space reclamation has to
|
||||
know what it cannot see.
|
||||
- `node_content_status` / `node_document_status` / presence: possession evidence
|
||||
is per-blob and vault-blind, so "who holds this" answers for locked content
|
||||
as readily as for anything else.
|
||||
|
||||
### 6.4 Sync is the deniability killer, and it is structural
|
||||
|
||||
The literature's threat hierarchy is single-snapshot → multi-snapshot →
|
||||
online/continuous adversary, and the PDDB explicitly targets the first. Its own
|
||||
book concedes the second: with several backup images an adversary can diff the
|
||||
ciphertext and map which blocks are definitely used, "to an asymptotic limit of
|
||||
an adversary with a precise log of every write to disk, leading to zero
|
||||
deniability". The mitigation is `pddb churn` — re-nonce every used block,
|
||||
re-noise every free one — which takes 20-30 minutes and burns FLASH lifetime,
|
||||
and is therefore optional and rarely run. A published multiple-snapshot attack
|
||||
detects moderately sized hidden volumes from two snapshots with high
|
||||
probability.
|
||||
|
||||
An ensemble is a machine for producing snapshots.
|
||||
|
||||
- Every peer holds a copy of the catalog, including `vault_id` on every document
|
||||
row (`p2p/doc_sync.rs:247`). A locked vault on one node is fully enumerated on
|
||||
every other node's disk. Locking discloses nothing *less* the more nodes there
|
||||
are.
|
||||
- A revoked node keeps everything it had (`docs/NODE_REVOCATION.md` §3, and the
|
||||
§3c vault-key-rotation gap). That is a dated snapshot in the hands of exactly
|
||||
the party the revocation was aimed at.
|
||||
- Convergent encryption makes blob ciphertext **deterministic by design** —
|
||||
that is what buys dedup. So a blob's file name is a stable identifier of its
|
||||
ciphertext across time and across nodes, sitting in a directory entry. Two
|
||||
images of the blob store diff perfectly. (Cross-*vault* unlinkability does
|
||||
hold, and is the good half: the same file in two vaults has two unrelated
|
||||
hashes.)
|
||||
- Sync traffic itself is an online side channel, which is the strongest
|
||||
adversary class in the taxonomy.
|
||||
|
||||
The conclusion is not subtle: **deniability and sync are close to incompatible
|
||||
at the catalog layer.** A vault that is meant to be deniable would have to not
|
||||
sync at all, or sync on a plane of its own that does not put `vault_id` in a
|
||||
record every peer keeps — which is a protocol redesign, not a feature. That is
|
||||
a reason to defer deniability deliberately, not a reason to half-build it.
|
||||
|
||||
### 6.5 The bootstrapping trap
|
||||
|
||||
Raised against the PDDB and never resolved: a user has to *remember* the secret
|
||||
Basis' name and password with no on-device record, and any list of Basis names
|
||||
they keep is itself the leak. One commenter called it a self-referential UX
|
||||
trap. It is the direct consequence of §4C, and it is the practical reason most
|
||||
deniable systems go unused.
|
||||
|
||||
The escape is the same fork: a locked-but-visible vault can be listed by name in
|
||||
the UI, which removes the trap entirely at the cost of the deniability that was
|
||||
never really achievable here anyway.
|
||||
|
||||
### 6.6 The loss-of-data attack
|
||||
|
||||
bunnie names it: an adversary who can write to the device can fill the free
|
||||
space with garbage and destroy any hidden Basis, without ever finding it. The
|
||||
local analogue is §6.3's vault-blind eviction, which does this by accident. The
|
||||
ensemble analogue is worse — a node that does not hold a vault's key still
|
||||
participates in sync policy and blob possession decisions, so "nobody holds the
|
||||
last copy" can be concluded about content nobody present can read.
|
||||
|
||||
---
|
||||
|
||||
## 7. What to decide now
|
||||
|
||||
Ordered by how much they constrain later work.
|
||||
|
||||
**7.1 Write down that vaults are locked, not hidden.**
|
||||
Amend `docs/data-model.md` §Security/Vault Model to state the §1 distinction
|
||||
explicitly, and to say that a locked vault conceals *content*, not *existence*.
|
||||
The "cop-with-open-phone" line stays — it is the accurate threat — but should
|
||||
stop being the only sentence about the threat model, because it currently reads
|
||||
as a deniability claim to anyone who arrives from that literature. Whatever the
|
||||
UI eventually says about a locked vault belongs in `copy::vault`, once, for all
|
||||
four modalities.
|
||||
|
||||
**7.2 Give "locked" a state, not an error.**
|
||||
`blob_store::vault_key` returning `VaultKeyNotFound` is the wrong shape for a
|
||||
vault the user could open by typing something. A locked vault is a state
|
||||
alongside `DocumentAvailability`'s three, and it has to be reachable *before*
|
||||
render, not discovered at decrypt time — §4B and §6.2.
|
||||
|
||||
**7.3 Fix the write-target question before there is a second vault.**
|
||||
Decide the default (recommendation: most recently unlocked, explicitly
|
||||
overridable, per the PDDB) and pin settings documents and every other
|
||||
system-written record to the default vault at the type level, not by convention
|
||||
— §4A.
|
||||
|
||||
**7.4 Decide whether the passphrase vault stores a salt.**
|
||||
Recommendation: yes, and accept that this forecloses deniability for that
|
||||
variant. Note in `long-term-todo.md` that a hidden vault, if ever wanted, is a
|
||||
separate `VaultKeySpec` variant with three non-negotiable rules — no per-vault
|
||||
record on disk, a global salt block, and its own sync story or none — and that
|
||||
the trigger is a threat model that includes a forensic image of a node.
|
||||
|
||||
**7.5 Close the property/artifact gap or stop claiming it.**
|
||||
Right now the vault boundary holds for blob bytes and nothing else, while
|
||||
`docs/document-sync.md` says otherwise. Encrypting `value` under the vault key
|
||||
is the intended end state and the columns are already `BLOB`; the work is
|
||||
figuring out what breaks — anything that filters, sorts, or indexes on a value,
|
||||
and the search index in particular. Until it is done, the doc should say what is
|
||||
true.
|
||||
|
||||
**7.6 Two cheap things that need no decision:**
|
||||
bind `vault_id` as AAD in the vault key wrap (§4F), and make eviction, the
|
||||
content ledger, and the last-copy guard vault-aware before a second vault can
|
||||
exist (§6.3, §6.6) — the second is a data-loss bug, not a privacy one.
|
||||
|
||||
**7.7 Worth having regardless:** an offline store verifier (§4G).
|
||||
|
||||
---
|
||||
|
||||
## 8. Documentation drift spotted along the way
|
||||
|
||||
- `docs/data-model.md`: "the actual encryption of Property/Artifact/Blob content
|
||||
under the vault key is the remaining step" — blob content is done (ADR 0028,
|
||||
`vault::BlobSealer`). Only Property and Artifact values remain.
|
||||
- `docs/document-sync.md` §Vault identity: "the receiver cannot decrypt the
|
||||
content without the vault key" is true of blob bytes, not of property values,
|
||||
which travel and rest in plaintext.
|
||||
- `docs/data-model.md` §Vault Key Versioning describes rotation as though
|
||||
`version` were stored per node per vault. `vault_keys` has no version column
|
||||
and `default_vault()` hard-codes `version: 1` — already noted in TODO.md
|
||||
under revocation phase 3c, and worth cross-referencing from the data model.
|
||||
|
||||
---
|
||||
|
||||
## 9. Sources
|
||||
|
||||
- [The PDDB — Xous book, ch. 9](https://betrusted.io/xous-book/ch09-00-pddb-overview.html),
|
||||
including
|
||||
[Basis Internal Structure](https://betrusted.io/xous-book/ch09-01-basis.html),
|
||||
[Deriving the PDDB's Keys](https://betrusted.io/xous-book/ch09-02-rootkeys.html),
|
||||
[Native API](https://betrusted.io/xous-book/ch09-03-api-native.html),
|
||||
[Backups](https://betrusted.io/xous-book/ch09-06-backups.html) and
|
||||
[Security and Deniability](https://betrusted.io/xous-book/ch09-07-discussion.html)
|
||||
- [bunnie, "The Plausibly Deniable DataBase (PDDB)"](https://www.bunniestudios.com/blog/2022/the-plausibly-deniable-database-pddb/)
|
||||
— design rationale, self-stated limitations, and a comment thread that is
|
||||
itself a good review of the idea
|
||||
- [SoK: Plausibly Deniable Storage](https://eprint.iacr.org/2021/1547.pdf) —
|
||||
the single/multi-snapshot/online adversary taxonomy used in §6.4
|
||||
- [A Multiple Snapshot Attack on Deniable Storage Systems](https://arxiv.org/pdf/2110.04618)
|
||||
— a concrete two-snapshot attack against implemented deniable stores
|
||||
- [Shufflecake: Plausible Deniability for Multiple Hidden Filesystems on Linux](https://arxiv.org/abs/2310.04589)
|
||||
— the current block-layer approach, for contrast with the PDDB's
|
||||
filesystem-layer one
|
||||
Reference in new issue
Block a user