mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 05:36:46 +00:00
tweaks
This commit is contained in:
parent
7ce73c5490
commit
bc95aa561e
4 changed files with 7 additions and 7 deletions
|
|
@ -39,7 +39,6 @@ var wantsMsg = ` wants you to sign in with your Ethereum account:\n`
|
||||||
var address = `(0x[a-fA-F0-9]{40})\n`
|
var address = `(0x[a-fA-F0-9]{40})\n`
|
||||||
|
|
||||||
// Optional statement (any line not containing "\n\n")
|
// Optional statement (any line not containing "\n\n")
|
||||||
// var statement = `(?:[^\n]+\n)?`
|
|
||||||
var statement = `(?:.*\n)?`
|
var statement = `(?:.*\n)?`
|
||||||
|
|
||||||
// URI
|
// URI
|
||||||
|
|
@ -77,13 +76,15 @@ var siweMessageRegex = regexp.MustCompile(`(?m)^` + scheme + domain + wantsMsg +
|
||||||
|
|
||||||
var ErrMalformedSIWEMessage = errors.New("the message is asking to sign in with Ethereum but does not conform to EIP-4361")
|
var ErrMalformedSIWEMessage = errors.New("the message is asking to sign in with Ethereum but does not conform to EIP-4361")
|
||||||
|
|
||||||
|
const suggestiveLanguage = "wants you to sign in with your Ethereum account"
|
||||||
|
|
||||||
func validateSIWE(req *SignDataRequest) error {
|
func validateSIWE(req *SignDataRequest) error {
|
||||||
for _, message := range req.Messages {
|
for _, message := range req.Messages {
|
||||||
s, ok := message.Value.(string)
|
s, ok := message.Value.(string)
|
||||||
if !ok {
|
if !ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if !strings.Contains(s, "wants you to sign in with your Ethereum account") {
|
if !strings.Contains(s, suggestiveLanguage) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
1
signer/core/testdata/siwe/warnings.json
vendored
1
signer/core/testdata/siwe/warnings.json
vendored
|
|
@ -32,5 +32,4 @@
|
||||||
"No scheme - ://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body": "service.org wants you to sign in with your Ethereum account:\n0x{{Account}}\n\n\nURI: ://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z",
|
"No scheme - ://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body": "service.org wants you to sign in with your Ethereum account:\n0x{{Account}}\n\n\nURI: ://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z",
|
||||||
"bad query - uri://user:pass@example.com:123/one/two.three ?q1=a1&q2=a2#body": "service.org wants you to sign in with your Ethereum account:\n0x{{Account}}\n\n\nURI: uri://user:pass@example.com:123/one/two.three ?q1=a1&q2=a2#body\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z",
|
"bad query - uri://user:pass@example.com:123/one/two.three ?q1=a1&q2=a2#body": "service.org wants you to sign in with your Ethereum account:\n0x{{Account}}\n\n\nURI: uri://user:pass@example.com:123/one/two.three ?q1=a1&q2=a2#body\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z",
|
||||||
"bad fragment - uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2 #body": "service.org wants you to sign in with your Ethereum account:\n0x{{Account}}\n\n\nURI: uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2 #body\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z"
|
"bad fragment - uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2 #body": "service.org wants you to sign in with your Ethereum account:\n0x{{Account}}\n\n\nURI: uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2 #body\nVersion: 1\nChain ID: 1\nNonce: 32891757\nIssued At: 2021-09-30T16:25:24.000Z"
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue