aboutsummaryrefslogtreecommitdiffstats
path: root/signer/core/cliui.go
diff options
context:
space:
mode:
authorMartin Holst Swende <martin@swende.se>2018-09-25 21:54:58 +0800
committerGitHub <noreply@github.com>2018-09-25 21:54:58 +0800
commitd3441ebb563439bac0837d70591f92e2c6080303 (patch)
treecec46689f8ec4fd4570322e79ad7167c3b792c74 /signer/core/cliui.go
parenta95a601f35c49be6045de522138f639fbb68c885 (diff)
downloadgo-tangerine-d3441ebb563439bac0837d70591f92e2c6080303.tar
go-tangerine-d3441ebb563439bac0837d70591f92e2c6080303.tar.gz
go-tangerine-d3441ebb563439bac0837d70591f92e2c6080303.tar.bz2
go-tangerine-d3441ebb563439bac0837d70591f92e2c6080303.tar.lz
go-tangerine-d3441ebb563439bac0837d70591f92e2c6080303.tar.xz
go-tangerine-d3441ebb563439bac0837d70591f92e2c6080303.tar.zst
go-tangerine-d3441ebb563439bac0837d70591f92e2c6080303.zip
cmd/clef, signer: security fixes (#17554)
* signer: remove local path disclosure from extapi * signer: show more data in cli ui * rpc: make http server forward UA and Origin via Context * signer, clef/core: ui changes + display UA and Origin * signer: cliui - indicate less trust in remote headers, see https://github.com/ethereum/go-ethereum/issues/17637 * signer: prevent possibility swap KV-entries in aes_gcm storage, fixes #17635 * signer: remove ecrecover from external API * signer,clef: default reject instead of warn + valideate new passwords. fixes #17632 and #17631 * signer: check calldata length even if no ABI signature is present * signer: fix failing testcase * clef: remove account import from external api * signer: allow space in passwords, improve error messsage * signer/storage: fix typos
Diffstat (limited to 'signer/core/cliui.go')
-rw-r--r--signer/core/cliui.go33
1 files changed, 21 insertions, 12 deletions
diff --git a/signer/core/cliui.go b/signer/core/cliui.go
index 2f969669c..cc237612e 100644
--- a/signer/core/cliui.go
+++ b/signer/core/cliui.go
@@ -25,7 +25,7 @@ import (
"sync"
"github.com/davecgh/go-spew/spew"
- "github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/internal/ethapi"
"github.com/ethereum/go-ethereum/log"
"golang.org/x/crypto/ssh/terminal"
@@ -95,6 +95,8 @@ func (ui *CommandlineUI) confirm() bool {
func showMetadata(metadata Metadata) {
fmt.Printf("Request context:\n\t%v -> %v -> %v\n", metadata.Remote, metadata.Scheme, metadata.Local)
+ fmt.Printf("\nAdditional HTTP header data, provided by the external caller:\n")
+ fmt.Printf("\tUser-Agent: %v\n\tOrigin: %v\n", metadata.UserAgent, metadata.Origin)
}
// ApproveTx prompt the user for confirmation to request to sign Transaction
@@ -111,18 +113,22 @@ func (ui *CommandlineUI) ApproveTx(request *SignTxRequest) (SignTxResponse, erro
} else {
fmt.Printf("to: <contact creation>\n")
}
- fmt.Printf("from: %v\n", request.Transaction.From.String())
- fmt.Printf("value: %v wei\n", weival)
+ fmt.Printf("from: %v\n", request.Transaction.From.String())
+ fmt.Printf("value: %v wei\n", weival)
+ fmt.Printf("gas: %v (%v)\n", request.Transaction.Gas, uint64(request.Transaction.Gas))
+ fmt.Printf("gasprice: %v wei\n", request.Transaction.GasPrice.ToInt())
+ fmt.Printf("nonce: %v (%v)\n", request.Transaction.Nonce, uint64(request.Transaction.Nonce))
if request.Transaction.Data != nil {
d := *request.Transaction.Data
if len(d) > 0 {
- fmt.Printf("data: %v\n", common.Bytes2Hex(d))
+
+ fmt.Printf("data: %v\n", hexutil.Encode(d))
}
}
if request.Callinfo != nil {
fmt.Printf("\nTransaction validation:\n")
for _, m := range request.Callinfo {
- fmt.Printf(" * %s : %s", m.Typ, m.Message)
+ fmt.Printf(" * %s : %s\n", m.Typ, m.Message)
}
fmt.Println()
@@ -196,7 +202,9 @@ func (ui *CommandlineUI) ApproveListing(request *ListRequest) (ListResponse, err
fmt.Printf("A request has been made to list all accounts. \n")
fmt.Printf("You can select which accounts the caller can see\n")
for _, account := range request.Accounts {
- fmt.Printf("\t[x] %v\n", account.Address.Hex())
+ fmt.Printf(" [x] %v\n", account.Address.Hex())
+ fmt.Printf(" URL: %v\n", account.URL)
+ fmt.Printf(" Type: %v\n", account.Typ)
}
fmt.Printf("-------------------------------------------\n")
showMetadata(request.Meta)
@@ -212,10 +220,10 @@ func (ui *CommandlineUI) ApproveNewAccount(request *NewAccountRequest) (NewAccou
ui.mu.Lock()
defer ui.mu.Unlock()
- fmt.Printf("-------- New Account request--------------\n")
- fmt.Printf("A request has been made to create a new. \n")
- fmt.Printf("Approving this operation means that a new Account is created,\n")
- fmt.Printf("and the address show to the caller\n")
+ fmt.Printf("-------- New Account request--------------\n\n")
+ fmt.Printf("A request has been made to create a new account. \n")
+ fmt.Printf("Approving this operation means that a new account is created,\n")
+ fmt.Printf("and the address is returned to the external caller\n\n")
showMetadata(request.Meta)
if !ui.confirm() {
return NewAccountResponse{false, ""}, nil
@@ -225,8 +233,9 @@ func (ui *CommandlineUI) ApproveNewAccount(request *NewAccountRequest) (NewAccou
// ShowError displays error message to user
func (ui *CommandlineUI) ShowError(message string) {
-
- fmt.Printf("ERROR: %v\n", message)
+ fmt.Printf("-------- Error message from Clef-----------\n")
+ fmt.Println(message)
+ fmt.Printf("-------------------------------------------\n")
}
// ShowInfo displays info message to user