Repository Public
1# Threat model23SP Vault holds photographs and details of one person's identity documents and bank cards on one iPhone. It has no server, no account and no network code. This document says what it defends against, how, and what it does not defend against.45## Assets67| Asset | Sensitivity |8|---|---|9| Photographs of cards (front and back) | High — enough to impersonate or to pay online if the security code were present |10| Card and document numbers, holder name, expiry, notes, custom fields | High |11| Master key, per-card keys | Critical — they open everything above |12| Recovery passphrase, backup passphrase | Critical — never stored |13| Search index | High — derived from the records |14| Interface preferences (layout, appearance, reminder defaults) | Low — kept in `UserDefaults`, describe no card |1516## Trust boundaries1718The app trusts iOS, the Secure Enclave, the Keychain and Apple's cryptographic frameworks. It trusts nothing that arrives from outside its sandbox: a `.spvault` file is parsed defensively and fully authenticated before a single card is written.1920## Threats and mitigations2122| # | Threat | Mitigation | Residual risk |23|---|---|---|---|24| T1 | Someone picks up the unlocked iPhone and opens the app | Face ID at every launch and every return from the background; the key is read from the Keychain behind `biometryCurrentSet`; no passcode fallback | A person who can pass Face ID as the owner |25| T2 | Someone who knows the iPhone passcode adds their own face | `biometryCurrentSet`: the Keychain item is invalidated by any change of the enrolled set; the vault then asks for the recovery passphrase | If that person also knows the recovery passphrase |26| T3 | The file system is extracted (forensic tool, jailbreak, stolen backup) | Vault directory excluded from backups; every file AES-256-GCM under keys that exist only behind the Keychain; `NSFileProtectionComplete` | `recovery.key` can be attacked offline: strength of the passphrase × 600 000 PBKDF2 iterations |27| T4 | A file is altered, replaced by an older or foreign one, or moved between cards | AES-GCM authentication with `vault | card | file` bound as AAD; damaged cards are reported | Rollback of a *whole* card directory to an earlier valid state of the same card is not detected |28| T5 | The app is switched away from while a card is on screen | Lock when the scene enters the background; opaque curtain window above everything as soon as the app is inactive, so the switcher snapshot shows no card | — |29| T6 | Navigation trick to reach content while locked | The unlocked shell is not in the view hierarchy while locked; decrypted data and key are dropped at lock, so there is nothing to show | — |30| T7 | Shoulder surfing | Numbers masked by default, last four only in lists; full number needs a fresh Face ID check and hides itself after 30 s; Privacy Mode veils card faces | Whoever watches during a reveal |31| T8 | Screenshots and screen recording | Recording/mirroring detected (`isSceneCaptured`) → curtain; screenshots are detected after the fact and reported (banner + generic notification) | **iOS does not let an app prevent a screenshot.** A screenshot taken while a card is visible lands in Photos |32| T9 | Clipboard leakage | Nothing is ever copied automatically; an explicit copy is local-only (no Universal Clipboard) and expires after 60 s | Another app pasting within those 60 s (iOS shows the paste banner) |33| T10 | Notifications on the lock screen | Reminder text is generic and names no card; no widget, no Spotlight indexing, no Siri donation | — |34| T11 | The security code of a bank card ends up stored | No such field exists; forbidden labels and track-data patterns are refused; the code is blacked out in the photograph before encryption, with a manual validation step | A code the owner types into free-text notes on purpose; a code printed on the *front* that the owner does not mask |35| T12 | Data sent off the device | No networking code, no third-party SDK, no analytics, no crash reporter; logs contain no card data | iOS's own diagnostics are outside the app's control (they contain no vault content) |36| T13 | Malicious or corrupted `.spvault` file | Length checks, version check, minimum KDF cost, per-record authentication with index and final flag, card-count check, sanitising on restore | A very large file costs memory (single-owner use; not hardened against resource exhaustion) |37| T14 | Loss of the iPhone or of Face ID access | Encrypted `.spvault` export; optional recovery passphrase | No backup and no recovery passphrase means the data is lost — by design |38| T15 | Interrupted write, full disk | Atomic file writes; staged card creation; failed saves leave the vault unchanged | — |39| T16 | Camera captures leaking | Captures stay in memory as bitmaps; nothing is written to Photos or to a temporary file | — |4041## Out of scope4243- A compromised operating system (jailbreak with a live kernel implant) while the vault is unlocked: the key is then in the memory of a process the attacker controls.44- Coercion of the owner.45- Hardware attacks on the Secure Enclave.46- Protection of exported `.spvault` files against a weak passphrase chosen despite the policy.4748## Privacy statement4950SP Vault collects nothing, transmits nothing and contains no tracking. The privacy manifest (`PrivacyInfo.xcprivacy`) declares no collected data type and no tracking domain.51