Skip to content

chore: clear wear restore secrets from memory #2179

Backlog

Description

@jvsena42

Part of #2105.
Source: review, #2177

On the watch, the restore flow and the seed store hold the recovery words and the passphrase as Kotlin Strings, which can't be wiped and stay on the heap until GC. The seed bytes are zeroed after use, but the words, the joined mnemonic passed to bitkit-core and the passphrase are not.

Proposal

  • Keep the words and passphrase in CharArray/ByteArray buffers owned by the restore view model, and zero them on save, failure, background and onCleared.
  • Check what bitkit-core and the Breez SDK accept without a String, and keep the String lifetime to the single call where one is required.

Done when

  • The restore flow keeps no String copy of a word or passphrase past the save call, and unit tests check that the buffers are zeroed.

Found in the pre-PR review of the Wear OS foundation PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions