From 012f9d601edb95780bad41cb7e85c3af128d752b Mon Sep 17 00:00:00 2001 From: Weixie Cui Date: Sat, 11 Jul 2026 23:27:56 +0800 Subject: [PATCH] cmd/devp2p: handle password prompt error in loadSigningKey PromptPassword errors were ignored when loading a DNS signing key, which could proceed with an empty password. Fail early when reading the password fails. --- cmd/devp2p/dnscmd.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/devp2p/dnscmd.go b/cmd/devp2p/dnscmd.go index 0fce7b1030..13a8814eaa 100644 --- a/cmd/devp2p/dnscmd.go +++ b/cmd/devp2p/dnscmd.go @@ -257,7 +257,10 @@ func loadSigningKey(keyfile string) *ecdsa.PrivateKey { if err != nil { exit(fmt.Errorf("failed to read the keyfile at '%s': %v", keyfile, err)) } - password, _ := prompt.Stdin.PromptPassword("Please enter the password for '" + keyfile + "': ") + password, err := prompt.Stdin.PromptPassword("Please enter the password for '" + keyfile + "': ") + if err != nil { + exit(fmt.Errorf("error reading password: %v", err)) + } key, err := keystore.DecryptKey(keyjson, password) if err != nil { exit(fmt.Errorf("error decrypting key: %v", err))