Skip to content

Bit 87 coldkey encryption security#1251

Closed
isabella618033 wants to merge 29 commits intorelease/security_updatefrom
BIT-87-coldkey_encryption_security
Closed

Bit 87 coldkey encryption security#1251
isabella618033 wants to merge 29 commits intorelease/security_updatefrom
BIT-87-coldkey_encryption_security

Conversation

@isabella618033
Copy link
Contributor

@isabella618033 isabella618033 commented Apr 5, 2023

#2 Update wallet from Ansible Vault to NaCl & argon2i password hashing.

Wallets can be updated with the following scenario

  • btcli update_wallet --all
  • After running a transfer/stake/unstake/delegate command, keyfile version would be checked and advised to get updated.

(successful update with legacy_wallet_2478, failure in update with legacy_wallet_7807, all other wallets had been updated previously)
image

@isabella618033 isabella618033 marked this pull request as draft April 6, 2023 20:53
@isabella618033 isabella618033 changed the base branch from staging to release/security_update April 19, 2023 16:41
@isabella618033 isabella618033 marked this pull request as ready for review April 19, 2023 17:45
is_nacl (bool):
True if data is ansible encrypted.
"""
return keyfile_data[:len('$NACL')] == b'$NACL'
Copy link
Contributor

Choose a reason for hiding this comment

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

does it make sense to create a variable with the '$NACL' value to not use it twice?

kdf = pwhash.argon2i.kdf
key = kdf(secret.SecretBox.KEY_SIZE, password, NACL_SALT, opslimit=pwhash.argon2i.OPSLIMIT_SENSITIVE, memlimit=pwhash.argon2i.MEMLIMIT_SENSITIVE)
box = secret.SecretBox(key)
decrypted_keyfile_data = box.decrypt(keyfile_data[len('$NACL'):])
Copy link
Contributor

Choose a reason for hiding this comment

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

another usage of the value where we could use the variable/constant with '$NACL'

import getpass
from rich.prompt import Confirm
import json
from bittensor._keyfile.keyfile_impl import encrypt_keyfile_data, decrypt_keyfile_data, keyfile_data_is_encrypted, keyfile_data_is_encrypted_nacl, keyfile_data_is_encrypted_ansible
Copy link
Contributor

Choose a reason for hiding this comment

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

we are already importing bittensor, right? Is this needed?

@shibshib
Copy link
Contributor

This PR is pretty important but stale now, what's the status here @isabella618033 ?

@camfairchild
Copy link
Contributor

This PR is pretty important but stale now, what's the status here @isabella618033 ?

Following up on this. Are we expecting to add this still?

@ifrit98
Copy link
Contributor

ifrit98 commented Jul 26, 2023

This PR is pretty important but stale now, what's the status here @isabella618033 ?

Bump.

@isabella618033 isabella618033 changed the base branch from release/security_update to master July 26, 2023 17:58
@isabella618033 isabella618033 changed the base branch from master to release/security_update July 26, 2023 17:58
@ifrit98
Copy link
Contributor

ifrit98 commented Aug 25, 2023

Migrated to: #1497

@ifrit98 ifrit98 closed this Aug 25, 2023
@ifrit98 ifrit98 deleted the BIT-87-coldkey_encryption_security branch November 27, 2023 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants