trackslash
VAULT-75 P2

Pad saved backups to fixed sizes, so a backup's size doesn't show how much the vault holds

0
All issues

Description

Today: an export's encrypted payload gets a random 0.2–6 KB of padding (VaultBackupEncryptor, .random), but isn't rounded to a fixed size. A PDF prints "there are N QR codes" and "Page N of M", and each QR carries about 375 bytes of ciphertext. So a backup shows roughly how many items it holds.

The risk: after someone is given the duress password, finding a 60-code backup of the real vault next to a duress vault with 5 items shows a bigger vault exists.

Decision (Bradley, 2026-09-27): pad saved exports (PDF backups and auto-backups) up to fixed sizes.

  • A 32 KiB minimum of ciphertext, about 130 typical items, or roughly 90 QR codes. Above that, the next power of two (64, 128, 256 KiB …).
  • The padding has to be inside the encryption. The outer EncryptedVault JSON can be read without the password, so padding there would leave the real length readable. It goes in the payload's existing obfuscationPadding, sized so the compressed, encrypted payload lands just under the bucket. That keeps the backup format as it is, so older builds can still restore.
  • Device transfer keeps today's random padding. It saves nothing, and at 2 s per QR code a padded transfer would take about 3 minutes.

Not addressed here (guidance, not code): a real-vault backup that the duress vault's backup password can't open is a bigger tell than its size. Keep real-vault backups off the phone, and give the duress vault its own auto-backup folder.

Also: update docs/on-device-encryption.md (it says exports pad "by a random amount rather than to a fixed size"), and add tests that exports of very different vaults are the same size and still restore.

Sub-issues

0

Linked issues

0

GitHub

0

No branches or pull requests linked.

Comments

1
Bradley

Fixed in https://github.com/badbundle/vault-app/pull/670 (merged as 76f03c5f).

  • Saved exports and auto-backups are padded to a fixed size: 32 KiB minimum, then the next power of two that fits. The padding is inside the encrypted payload (obfuscationPadding), so the file size, the PDF's QR-code count and its page count all come in steps, and each step covers a wide range of vault sizes.
  • The encoder pads, compresses and measures, then adjusts the padding and repeats, stopping when the encrypted data lands within 16 bytes of the target. It aims for the middle of that window, so it usually needs one or two tries.
  • Device transfer keeps random padding. Both phones are in the same hands, so a fixed size gains nothing there, and the QR codes stay quick to scan.
  • docs/on-device-encryption.md now has a "Backup sizes" bullet, and the CHANGELOG has an entry.