Skip to content

keep-mobile: add Rust-side integrity verification over the foreign SecureStorage #785

Description

@kwsantiago

Problem

The SecureStorage trait (keep-mobile/src/storage.rs) is #[uniffi::export(with_foreign)], so mobile platforms provide the implementation. The Rust core trusts that implementation to preserve integrity: there is no Rust-side integrity check (MAC/HMAC) over stored blobs. A buggy or compromised foreign implementation could return different data than was stored, silently corrupt FROST share material, or fail to protect it, and the Rust core would not detect it.

Mitigating context

The Android implementation is Keystore-backed AES-GCM (AEAD), so stored data already has authenticated-encryption integrity at the platform layer. This is therefore defense-in-depth against a broken/compromised foreign impl, not a plaintext-integrity gap today.

Design decision needed

  1. Where the integrity key lives — it must be in a separate keystore slot; if it lives in the same SecureStorage, a compromised store compromises it too.
  2. Format + migration — adding a Rust-side MAC changes the stored blob format and requires migrating existing FROST share blobs. This is highly security-critical (a bug risks bricking access to shares), so it needs a versioned, backward-compatible migration.
  3. Whether it is worth it over the platform AEAD already present.

Acceptance criteria

  • Rust core verifies an integrity tag over stored share material on load, keyed independently of the foreign store.
  • Backward-compatible with existing blobs (no data loss on upgrade).

Metadata

Metadata

Assignees

No one assigned

    Labels

    architectureArchitectural decisions and patternsmobilekeep-mobile UniFFI bindingsp2PriorityrustPull requests that update rust codesecuritySecurity-related issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions