Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ The `zetacored` binary must be upgraded to trigger chain parameters data migrati

### Fixes

* [4562](https://github.com/zeta-chain/node/pull/4562) - add AllowInsecureUnlock guard to eth_sign and eth_signTypedData
* [4403](https://github.com/zeta-chain/node/pull/4403) - load Sui inbound cursors from database for all supported packages
* [4401](https://github.com/zeta-chain/node/pull/4401) - retry Sui inbound when the inbound vote RPC failed
* [4414](https://github.com/zeta-chain/node/pull/4414) - fix example package deployment by removing gateway object reference
Expand Down
10 changes: 10 additions & 0 deletions rpc/backend/sign_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ func (b *Backend) SendTransaction(args evmtypes.TransactionArgs) (common.Hash, e

// Sign signs the provided data using the private key of address via Geth's signature standard.
func (b *Backend) Sign(address common.Address, data hexutil.Bytes) (hexutil.Bytes, error) {
if !b.Cfg.JSONRPC.AllowInsecureUnlock {
b.Logger.Debug("account unlock with HTTP access is forbidden")
return nil, errors.New("account unlock with HTTP access is forbidden")
}

from := sdk.AccAddress(address.Bytes())

_, err := b.ClientCtx.Keyring.KeyByAddress(from)
Expand All @@ -143,6 +148,11 @@ func (b *Backend) Sign(address common.Address, data hexutil.Bytes) (hexutil.Byte

// SignTypedData signs EIP-712 conformant typed data
func (b *Backend) SignTypedData(address common.Address, typedData apitypes.TypedData) (hexutil.Bytes, error) {
if !b.Cfg.JSONRPC.AllowInsecureUnlock {
b.Logger.Debug("account unlock with HTTP access is forbidden")
return nil, errors.New("account unlock with HTTP access is forbidden")
}

from := sdk.AccAddress(address.Bytes())

_, err := b.ClientCtx.Keyring.KeyByAddress(from)
Expand Down
18 changes: 18 additions & 0 deletions rpc/backend/sign_tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,15 @@ func (s *TestSuite) TestSign() {
inputBz hexutil.Bytes
expPass bool
}{
{
"fail - insecure unlock not allowed",
func() {
s.backend.Cfg.JSONRPC.AllowInsecureUnlock = false
},
from,
nil,
false,
},
{
"fail - can't find key in Keyring",
func() {},
Expand Down Expand Up @@ -204,6 +213,15 @@ func (s *TestSuite) TestSignTypedData() {
inputTypedData apitypes.TypedData
expPass bool
}{
{
"fail - insecure unlock not allowed",
func() {
s.backend.Cfg.JSONRPC.AllowInsecureUnlock = false
},
from,
apitypes.TypedData{},
false,
},
{
"fail - can't find key in Keyring",
func() {},
Expand Down
Loading