cli: Detect key mismatch
When run with a secret and public key that do not cryptographically
match, fn radicle_cli::terminal::io::signer would prompt the user
for a password to unlock the secret key, and then carry on with a
mismatching key pair.
Fix this by verifying that the keys match in MemorySigner::load
and only swallow errors initializing the signer in cases where
prompting for a password makes sense. It does not make sense in the
case of mismatched keys.
6 files changed
+78
-20
ed8b0860
→
fafb3493
added crates/radicle-cli/examples/rad-key-mismatch.md
@@ -0,0 +1,6 @@
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
modified crates/radicle-cli/src/terminal/io.rs
@@ -45,9 +45,15 @@ impl inquire::validator::StringValidator for PassphraseValidator {
|
|
|
|
|
|
| - | |
| - | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
| + | |
|
|
|
|
|
modified crates/radicle-cli/tests/commands.rs
@@ -1,6 +1,6 @@
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -56,6 +56,20 @@ fn rad_auth() {
|
|
|
|
|
|
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
modified crates/radicle-crypto/src/ssh/keystore.rs
@@ -183,6 +183,8 @@ pub enum MemorySignerError {
|
|
|
|
|
|
| + | |
| + | |
|
|
|
|
|
@@ -272,6 +274,12 @@ impl MemorySigner {
|
|
|
|
|
|
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
modified crates/radicle-remote-helper/src/push.rs
@@ -74,6 +74,9 @@ pub enum Error {
|
|
|
|
|
|
| + | |
| + | |
| + | |
|
|
|
|
|
modified crates/radicle/src/profile.rs
@@ -172,14 +172,8 @@ pub enum Error {
|
|
|
|
|
|
| - | |
| - | |
|
|
|
|
| - | |
| - | |
| - | |
| - | |
|
|
|
|
|
@@ -194,6 +188,37 @@ pub enum Error {
|
|
|
|
|
|
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
@@ -296,7 +321,7 @@ impl Profile {
|
|
|
|
|
|
| - | |
| + | |
|
|
|
|
|
@@ -307,16 +332,12 @@ impl Profile {
|
|
|
|
|
|
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|