From fa213e7a1aa433688ed5daaa6643debeaacad18e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tadej=20Jane=C5=BE?= Date: Thu, 30 Jul 2020 14:19:20 +0200 Subject: [PATCH 1/2] go/oasis-node/cmd/common/consensus: Print helper text about txn review If one uses the signer plugin and a TTY, print a helper text to notify him that he may need to review the transaction on the device if a hardware-based signer plugin is used. --- .changelog/3149.feature.md | 5 +++++ go/oasis-node/cmd/common/consensus/consensus.go | 14 +++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 .changelog/3149.feature.md diff --git a/.changelog/3149.feature.md b/.changelog/3149.feature.md new file mode 100644 index 00000000000..6c3d93040ab --- /dev/null +++ b/.changelog/3149.feature.md @@ -0,0 +1,5 @@ +go/oasis-node/cmd/common/consensus: Print helper text about transaction review + +If one uses the signer plugin and a TTY, print a helper text to notify him +that he may need to review the transaction on the device if a hardware-based +signer plugin is used. diff --git a/go/oasis-node/cmd/common/consensus/consensus.go b/go/oasis-node/cmd/common/consensus/consensus.go index 2201f146d67..a82777ddf0f 100644 --- a/go/oasis-node/cmd/common/consensus/consensus.go +++ b/go/oasis-node/cmd/common/consensus/consensus.go @@ -13,6 +13,7 @@ import ( "github.com/oasisprotocol/oasis-core/go/common/cbor" signerFile "github.com/oasisprotocol/oasis-core/go/common/crypto/signature/signers/file" + signerPlugin "github.com/oasisprotocol/oasis-core/go/common/crypto/signature/signers/plugin" "github.com/oasisprotocol/oasis-core/go/common/logging" "github.com/oasisprotocol/oasis-core/go/consensus/api/transaction" genesisAPI "github.com/oasisprotocol/oasis-core/go/genesis/api" @@ -123,9 +124,16 @@ func SignAndSaveTx(ctx context.Context, tx *transaction.Transaction) { fmt.Printf("You are about to sign the following transaction:\n") tx.PrettyPrint(ctx, " ", os.Stdout) - if !cmdFlags.AssumeYes() && cmdSigner.Backend() == signerFile.SignerName { - if !cmdCommon.GetUserConfirmation("\nAre you sure you want to continue? (y)es/(n)o: ") { - os.Exit(1) + switch cmdSigner.Backend() { + case signerFile.SignerName: + if !cmdFlags.AssumeYes() { + if !cmdCommon.GetUserConfirmation("\nAre you sure you want to continue? (y)es/(n)o: ") { + os.Exit(1) + } + } + case signerPlugin.SignerName: + if cmdCommon.Isatty(os.Stdin.Fd()) { + fmt.Println("\nYou may need to review the transaction on your device if you use a hardware-based signer plugin...") } } From d3ac3f0a54a4aa53c2a9a7e9f73461645c6ed106 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tadej=20Jane=C5=BE?= Date: Thu, 30 Jul 2020 14:30:01 +0200 Subject: [PATCH 2/2] go/oasis-node/cmd/common/signer: Remove ledger in signer flag's help It is no longer supported directly. --- go/oasis-node/cmd/common/signer/signer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/oasis-node/cmd/common/signer/signer.go b/go/oasis-node/cmd/common/signer/signer.go index 053ea1e13ce..bae033a6eb4 100644 --- a/go/oasis-node/cmd/common/signer/signer.go +++ b/go/oasis-node/cmd/common/signer/signer.go @@ -168,7 +168,7 @@ func doNewComposite(signerDir string, roles ...signature.SignerRole) (signature. } func init() { - Flags.StringP(CfgSigner, "s", "file", "signer backend [file, plugin, ledger, remote, composite]") + Flags.StringP(CfgSigner, "s", "file", "signer backend [file, plugin, remote, composite]") Flags.String(cfgSignerRemoteAddress, "", "remote signer server address") Flags.String(cfgSignerRemoteClientCert, "", "remote signer client certificate path") Flags.String(cfgSignerRemoteClientKey, "", "remote signer client certificate key path")