Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove optionals from wallet set up #4984

Conversation

jorgeantonio21
Copy link
Contributor

Description

Currently, it is possible to set up a wallet (in creation/recovery/existing mode) without a password. This is not desirable, as in that case, sensitive data might be potentially stored in the database and leak in memory. We address this issue by enforcing passphrase creation.

Motivation and Context

For more details see issue #4977.

How Has This Been Tested?

);
return Err(WalletStorageError::InvalidPassphrase);
let cipher = match (db_passphrase_hash, db_encryption_salt) {
(None, None) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will clean up this code in a posterior PR, which goal is to change the Backend api. Doing so here, would require a lot of further refactoring.

@jorgeantonio21 jorgeantonio21 marked this pull request as ready for review December 1, 2022 17:05
Copy link
Collaborator

@SWvheerden SWvheerden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good.
But I would say we need to remove all the possible encryption stuff in this PR.
This PR is already big, but most of the changes are tests.

We still have the ``apply_encryptionandremove_encryption` functions. I would remove them.
We are enforcing encryption, but in the same breath, we allow a public outward function to decrypt the db.

When this PR gets merged, we should not have the backend be in two possible states, it should only be encrypted.

base_layer/wallet/src/storage/sqlite_db/wallet.rs Outdated Show resolved Hide resolved
@jorgeantonio21 jorgeantonio21 added P-controversial Process - This PR or Issue is controversial and/or requires more attention that simpler issues A-mobile_wallet Area - related to Aurora, the mobile wallet A-wallet Area - related to the wallet A-wallet-ffi Area - Related to the wallet FFI lib A-security Area - Security related labels Dec 5, 2022
@stringhandler stringhandler merged commit 33e6dbf into tari-project:development Dec 7, 2022
stringhandler pushed a commit that referenced this pull request Dec 8, 2022
#5022)

Description
---
Enforces display of seed words for newly created wallet.

Motivation and Context
---
In a previous refactor (#4984), a component of the wallet was accidentally removed, namely the prompt of seed words for newly created wallet. 

How Has This Been Tested?
---
In a folder with no wallet db, run `cargo run --release --bin tari_console_wallet` and chose the option create new wallet.
stringhandler pushed a commit that referenced this pull request Jan 3, 2023
Description
---
Improves handling of database encryption keys.

Motivation and Context
---
A [recent PR](#4984) hardens the codebase's handling of encrypted database fields. It stores the derived key used for encryption as a `Zeroizing` array.

This work changes the key type to be a `Hidden` wrapper of a `SafeArray`, which prevents unintended output of the key and tries to prevent copies and moves.

How Has This Been Tested?
---
Existing tests pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mobile_wallet Area - related to Aurora, the mobile wallet A-security Area - Security related A-wallet Area - related to the wallet A-wallet-ffi Area - Related to the wallet FFI lib P-controversial Process - This PR or Issue is controversial and/or requires more attention that simpler issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants