-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
add no_password option for the seed command #57
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #57 +/- ##
======================================
Coverage 0.0% 0.0%
======================================
Files 16 23 +7
Lines 1437 2140 +703
======================================
- Misses 1437 2140 +703
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Thank you for your effort, I actually had that originally, but had removed lately. The seeds are shared between testnet and mainnet keys. They are generated only once and can be re-used, thus allowing to store them with no encryption is extremely dangerous. I do not want to repeat the story of Eric Voskuil (his libbitcoinconsensus wallet was hacked which led to the loss of funds and his reputation), thus I can't accept this change to the library. For tests, you can manually generate the seed, then derive a (set) of private keys for testnet with no password (that option is already present). This can be done once and manually, since you can make them part of the git history. With that approach, they can be used from test scripts with no passwords. |
For testing purposes, I can manually generate a seed (with a password) but then I cannot derive it without a password, as with -N I don't get prompted for the account password but I still do for the seed one. My goal is to make bp-wallet's CLI interface usable from a script, not to lower security, so I propose an alternative solution: drop |
b96c7e7
to
1154efa
Compare
From my understanding, password is required for working with seed, including account derivation - but the account has its own password, which for testnet accounts can be empty. And when you sign PSBT with such testnet account having empty password, you already have an If it doesn't work that way, this is a bug which has to be fixed. |
When I wrote
I meant that the current code cannot support the usage you suggest, as it's impossible to call derive without providing the seed password interactively. Signing is not an issue and already works for this use case, in fact my PR doesn't change it. What this PR currently does is:
Other workflows have not changed, specifically:
This PR can be seen as a fix for the bug you mention. |
No, that is not what I said :) I said that you can derive manually providing seed password - and no password for the derived private key, which is stored in file and can be then used in the script (with no password). You do not need to access seed file from the script, ever - that's the idea |
In fn derive(
seed_file: &Path,
scheme: Bip43,
account: HardenedIndex,
mainnet: bool,
output_file: &Path,
no_password: bool,
) -> Result<(), DataError> {
let seed_password = rpassword::prompt_password("Seed password: ")?; This means that when calling the If by "you can derive manually providing seed password" you mean entering it interactively, then that's not what I'm looking for. I'm looking to non-interactively provide it, e.g. via the |
My problem with providing password as a cli argument is the fact that this is very bad practice, which will make passwords becoming parts of the command history in explicit form... BP wallet cli is intended for the real-world use by users for keeping their bitcoins and thus should do whatever is possible not to leak any information like seed passwords even if used by fools. I am trying to figure out how to combine that requirement with testing needs. |
Command history can be disabled (e.g.
I tried to use I checked ssh and gpg, which you were wondering about, but they use agents to provide credentials in a non-interactive way and providing a bp-wallet agent would be overkill. I think using an environment variable would be a reasonable compromise:
With the var set in the environment, calling seed or derive should then work without any additional cmdline options. A user could still set the variable on the cmdline (e.g. If you agree, I'll update the PR with this solution. |
Yes, it seems environment variable is the exact solution we need. Thank you! |
1154efa
to
e57b67c
Compare
Updated to use the I briefly documented the possible security issue in both IMO this is good enough, do you agree? |
Hey @nicbus, while reviewing your PR, I'd suggest the following code changes: You can also review and apply these suggestions locally on your machine. Learn more about GitKraken Code Suggest
Join your team on GitKraken to speed up PR review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just small nit from my side in d2d49ce, otherwise looks great
This PR adds the
-N
option to theseed
command, as is already available for thederive
andsign
commands.