aboutsummaryrefslogtreecommitdiffstats
path: root/signer/core/types.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/types.go
parenta95a601f35c49be6045de522138f639fbb68c885 (diff)
downloaddexon-d3441ebb563439bac0837d70591f92e2c6080303.tar
dexon-d3441ebb563439bac0837d70591f92e2c6080303.tar.gz
dexon-d3441ebb563439bac0837d70591f92e2c6080303.tar.bz2
dexon-d3441ebb563439bac0837d70591f92e2c6080303.tar.lz
dexon-d3441ebb563439bac0837d70591f92e2c6080303.tar.xz
dexon-d3441ebb563439bac0837d70591f92e2c6080303.tar.zst
dexon-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/types.go')
-rw-r--r--signer/core/types.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/signer/core/types.go b/signer/core/types.go
index 2acc0a4f4..128055774 100644
--- a/signer/core/types.go
+++ b/signer/core/types.go
@@ -18,6 +18,7 @@ package core
import (
"encoding/json"
+ "fmt"
"strings"
"math/big"
@@ -60,6 +61,36 @@ type ValidationMessages struct {
Messages []ValidationInfo
}
+const (
+ WARN = "WARNING"
+ CRIT = "CRITICAL"
+ INFO = "Info"
+)
+
+func (vs *ValidationMessages) crit(msg string) {
+ vs.Messages = append(vs.Messages, ValidationInfo{CRIT, msg})
+}
+func (vs *ValidationMessages) warn(msg string) {
+ vs.Messages = append(vs.Messages, ValidationInfo{WARN, msg})
+}
+func (vs *ValidationMessages) info(msg string) {
+ vs.Messages = append(vs.Messages, ValidationInfo{INFO, msg})
+}
+
+/// getWarnings returns an error with all messages of type WARN of above, or nil if no warnings were present
+func (v *ValidationMessages) getWarnings() error {
+ var messages []string
+ for _, msg := range v.Messages {
+ if msg.Typ == WARN || msg.Typ == CRIT {
+ messages = append(messages, msg.Message)
+ }
+ }
+ if len(messages) > 0 {
+ return fmt.Errorf("Validation failed: %s", strings.Join(messages, ","))
+ }
+ return nil
+}
+
// SendTxArgs represents the arguments to submit a transaction
type SendTxArgs struct {
From common.MixedcaseAddress `json:"from"`