SPB Git

Repository Public

SECURITY_AUDIT.md 8.3 KB

# Security and quality audit — 1.0.0

Date: 2026-12-02. Scope: commit history up to the 1.0.0 release candidate. Every line below states what was actually run. What could not be run is listed at the end, not implied.

# Environment

Xcode 27.2 (27B52), Swift 6.4.2, iOS 26.5 simulator (iPhone 17 Pro; spot checks on iPhone SE 3rd generation and iPhone 17 Pro Max). No physical iPhone was connected, so nothing in this audit ran on a device.

# Automated tests

Suite Result
Unit tests (scripts/build.sh unit) 95 tests in 15 suites, all passed
UI tests (scripts/build.sh uitest) 25 tests, 0 failures (wallet 8, security/settings screens 12, scanner 4, launch 1)
Real LocalAuthentication path (scripts/biometry-check.sh) 2 tests passed: matching simulated face creates and reopens the vault; non-matching face leaves it locked

Brief §20 item by item:

Requirement Evidence
Encryption / decryption CryptoTests.sealAndOpenRoundTrip, StorageTests.cardRoundTrip
Altered data detected alteringAnyByteIsDetected (every third byte of a blob), alteredFilesAreReportedAsDamaged, filesCannotBeSwappedBetweenCards
Wrong key wrongKeyIsRejected, wrongMasterKeyOpensNothing, aKeyThatIsNotTheVaultKeyOpensNothing
Face ID accepted / refused Scripted: creationThenLockThenFaceIDUnlock, refusedFaceIDKeepsTheVaultLocked (failed, cancelled, locked out). Real LAContext in the simulator: RealBiometryUITests
Biometric configuration change biometricChangeRequiresRecoveryPassphrase, withoutRecoveryABiometricChangeLeavesOnlyTheBackup; UI: invalidated key → recovery
Background WalletUITests.testBackgroundingLocksTheVault; Vault.lock() assertions (cards, index, image cache emptied)
Force quit, restart forceQuitAndRestartComeBackLocked (a new process finds the vault locked and intact)
Capture Simulator stand-in only (fictitious cards through a pinhole camera model): ScannerUITests. Real camera: not run
Perspective correction SmartScanTests (corner error and output ratio within tolerance)
OCR SmartScanTests on the specimen credit card and passport; parser tests including "never invent" and "never emit a security code"
CVV masking Detection on the specimen back, redaction makes the region uniformly black, a second OCR pass no longer reads the code; UI test of the validation step
Front/back flip WalletUITests.testFlipFullScreenAndFavourite; screenshots of both faces
Backup and restore BackupTests (round trip, no clear text, wrong passphrase, tampering, truncation, reordering, foreign file, version), restoreOnANewDevice
Interrupted write interruptedWriteLeavesNoPartialCard (failure injected at each of the five writes, plus a leftover staging directory)
Storage full fullDiskFailsCleanlyAndKeepsExistingData
No Internet The app has no network code (see below); the simulator runs were not made with the network disabled, because there is nothing that could use it
Card deletion deletionRemovesKeyAndFiles, testDeletingACardRemovesItFromTheWallet
Data migration schemaOneRecordsMigrate, newerFormatIsRefused

# Release binary inspection

Signed Release build for generic/platform=iOS (scripts/build.sh release): BUILD SUCCEEDED, codesign --verify --deep --strict passes.

Check Result
Identifier / team ai.spboucher.idcardvault / 3YM54G49SN, Apple Development certificate
Entitlements application-identifier, team-identifier, default-data-protection = NSFileProtectionComplete, get-task-allow (development signing). Nothing else
Linked frameworks AVFoundation, CoreGraphics, CoreHaptics, CoreImage, CoreMedia, CoreMotion, CoreVideo, CryptoKit, Foundation, ImageIO, LocalAuthentication, Security, SwiftUI, UIKit, UserNotifications, Vision, VisionKit and Swift runtime overlays. No third-party library, no CFNetwork, no WebKit
Network symbols (nm -u: URLSession, NSURLConnection, CFNetwork, nw_connection, sockets, getaddrinfo) 0
Test hooks in the binary (ScriptedKeyProtector, SimulatorKeyProtector, DemoCardFactory, SimulatedCamera, uiTesting, SPECIMEN) 0. One string remains, seedDemo: the name of an inert field of LaunchOptions; the code that reads launch arguments is compiled out
Usage descriptions Camera and Face ID only. No Photos, no location, no tracking
Size 8.0 MB

# Source inspection

Check (grep over SPVault/) Result
print, NSLog, os_log, Logger, dump none — the app writes no log line at all
URLSession, URLRequest, NWConnection, WKWebView none
Photos library, UIImageWriteToSavedPhotosAlbum none
CoreSpotlight, NSUserActivity, WidgetKit, CloudKit, iCloud none
UIPasteboard one call: explicit "Copy" after a Face ID reveal, localOnly, expires after 60 s
File writes three call sites, all ciphertext with completeFileProtection: vault blobs, the .spvault export, and (Debug only) the UI-test vault
Hard-coded passwords or keys none
Secret scan at every commit and push (sp-security-scan) no blocking finding; medium notices only on test fixtures (published test card numbers, test passphrases)

# Performance and memory (simulator)

  • leaks on the running app, card detail and grid wallet with eight cards: 0 leaks, 0 bytes. Physical footprint 53–104 MB, peak 131 MB (full-size decoded photographs are cached up to 160 MB and dropped at lock).
  • Instruments Time Profiler (xctrace, 25 s, carousel wallet): no hang risk; one potential hang of 431 ms at launch, during the Debug-only seeding of the demo vault (eight cards drawn and encrypted). Not present in a normal launch.
  • Frame-rate measurements need a device; none were made.

# Visual audit

Screenshots examined one by one, dark mode: wallet (stack, carousel, grid, categories, Privacy Mode), card detail (front, back, revealed number), full screen, editor, scanner (type picker, capture, crop, mask validation, preview front and back), onboarding (six steps and the skip-recovery warning), lock (refused, locked out, recovery, wrong passphrase), Security Center (three scroll positions and the recovery sheet), Expiry, Search (suggestions, results, no result), Settings, Backup (export sheet, ready, system exporter), Categories and editor, About. Light mode: wallet, card detail, and the security/settings screens checked by the screens work stream. Sizes: iPhone SE (3rd generation), iPhone 17 Pro, iPhone 17 Pro Max.

Fixed during the audit: full-screen card off-centre; card name hidden under the next card in Privacy Mode; holographic film too strong on light cards; coloured glow under the primary button; lock mark clipped on the recovery form; export file named with the UTC date.

Not examined: Dynamic Type at accessibility sizes, VoiceOver navigation, the erase confirmation sheets, the camera permission-denied screen, the screenshot banner.

# Not verified — needs the physical iPhone

  1. Installation on the device and first launch.
  2. Real Face ID: prompt, acceptance, refusal, lockout, and invalidation after enrolling another face (the production KeychainBiometricKeyProtector with biometryCurrentSet cannot run in the simulator).
  3. Real camera: live detection, auto-capture, orientation of frames and photos, torch, focus, VisionKit document mode, quality thresholds on real plastic cards, OCR accuracy on real cards.
  4. NSFileProtectionComplete enforcement and the Security Center's file-protection reading on a locked device.
  5. Core Motion reflections, Core Haptics patterns, 120 Hz rendering.
  6. App-switcher curtain and screen-recording detection on device.
  7. Notification delivery on the lock screen.
  8. .spvault import through the Files picker (the restore logic is unit-tested; the picker step was not driven end to end).

docs/INSTALLATION.md has the checklist for these.

# Known limits and future work

  • A screenshot cannot be prevented on iOS; it is detected and reported.
  • recovery.key is open to offline guessing by someone holding the file system; its strength is the passphrase and 600 000 PBKDF2 iterations.
  • Rollback of one card's directory to an earlier valid state of the same card is not detected.
  • The master key is not additionally wrapped by a Secure Enclave P-256 key (see CRYPTOGRAPHY.md); to be reconsidered once device testing is possible.
  • Interface in English only.
Files main
Menu

Theme