mirror of
https://github.com/status-im/status-go.git
synced 2025-02-18 01:37:22 +00:00
Remove shh and shhext from APIModules (#1131)
Addresses #912. By removing these two modules from APIModules, we disallow DApps from using dangerous methods like shh.SetMinPoW
This commit is contained in:
parent
a76bf4ec4d
commit
71b8e0e73d
@ -31,9 +31,9 @@ const (
|
|||||||
// ListenAddr is an IP address and port of this node (e.g. 127.0.0.1:30303).
|
// ListenAddr is an IP address and port of this node (e.g. 127.0.0.1:30303).
|
||||||
ListenAddr = ":0"
|
ListenAddr = ":0"
|
||||||
|
|
||||||
// APIModules is a list of modules to expose via any type of RPC (HTTP, IPC, in-proc)
|
// APIModules is a list of modules to expose via HTTP and `CallRPC()` binding.
|
||||||
// we also expose 2 limited personal APIs by overriding them in `api/backend.go`
|
// We also expose all handlers registered with `rpc.Client.RegisterHandler` to `CallRPC()` binding.
|
||||||
APIModules = "eth,net,web3,shh,shhext,peer"
|
APIModules = "eth,net,web3,peer"
|
||||||
|
|
||||||
// SendTransactionMethodName defines the name for a giving transaction.
|
// SendTransactionMethodName defines the name for a giving transaction.
|
||||||
SendTransactionMethodName = "eth_sendTransaction"
|
SendTransactionMethodName = "eth_sendTransaction"
|
||||||
|
@ -130,7 +130,7 @@ func (s *RPCTestSuite) TestCallRawResult() {
|
|||||||
|
|
||||||
s.NoError(s.StatusNode.Start(nodeConfig))
|
s.NoError(s.StatusNode.Start(nodeConfig))
|
||||||
|
|
||||||
client := s.StatusNode.RPCClient()
|
client := s.StatusNode.RPCPrivateClient()
|
||||||
s.NotNil(client)
|
s.NotNil(client)
|
||||||
|
|
||||||
jsonResult := client.CallRaw(`{"jsonrpc":"2.0","method":"shh_version","params":[],"id":67}`)
|
jsonResult := client.CallRaw(`{"jsonrpc":"2.0","method":"shh_version","params":[],"id":67}`)
|
||||||
|
@ -31,10 +31,11 @@ func (s *MailServiceSuite) TestShhextRequestMessagesRPCMethodAvailability() {
|
|||||||
|
|
||||||
s.StartTestNode(func(config *params.NodeConfig) {
|
s.StartTestNode(func(config *params.NodeConfig) {
|
||||||
config.RPCEnabled = true
|
config.RPCEnabled = true
|
||||||
|
config.AddAPIModule("shhext")
|
||||||
})
|
})
|
||||||
defer s.StopTestNode()
|
defer s.StopTestNode()
|
||||||
|
|
||||||
client := s.StatusNode.RPCClient()
|
client := s.StatusNode.RPCPrivateClient()
|
||||||
r.NotNil(client)
|
r.NotNil(client)
|
||||||
|
|
||||||
// This error means that the method is available through inproc communication
|
// This error means that the method is available through inproc communication
|
||||||
|
@ -62,7 +62,7 @@ func (s *WhisperExtensionSuite) TestSentSignal() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
defer signal.ResetDefaultNodeNotificationHandler()
|
defer signal.ResetDefaultNodeNotificationHandler()
|
||||||
client := s.nodes[0].RPCClient()
|
client := s.nodes[0].RPCPrivateClient()
|
||||||
s.NotNil(client)
|
s.NotNil(client)
|
||||||
var symID string
|
var symID string
|
||||||
s.NoError(client.Call(&symID, "shh_newSymKey"))
|
s.NoError(client.Call(&symID, "shh_newSymKey"))
|
||||||
@ -102,7 +102,7 @@ func (s *WhisperExtensionSuite) TestExpiredSignal() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
defer signal.ResetDefaultNodeNotificationHandler()
|
defer signal.ResetDefaultNodeNotificationHandler()
|
||||||
client := s.nodes[0].RPCClient()
|
client := s.nodes[0].RPCPrivateClient()
|
||||||
s.NotNil(client)
|
s.NotNil(client)
|
||||||
var symID string
|
var symID string
|
||||||
s.NoError(client.Call(&symID, "shh_newSymKey"))
|
s.NoError(client.Call(&symID, "shh_newSymKey"))
|
||||||
|
@ -74,7 +74,7 @@ func (s *WhisperMailboxSuite) TestRequestMessageFromMailboxAsync() {
|
|||||||
MailServerKeyID, err := senderWhisperService.AddSymKeyFromPassword(password)
|
MailServerKeyID, err := senderWhisperService.AddSymKeyFromPassword(password)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
|
||||||
rpcClient := sender.StatusNode().RPCClient()
|
rpcClient := sender.StatusNode().RPCPrivateClient()
|
||||||
s.Require().NotNil(rpcClient)
|
s.Require().NotNil(rpcClient)
|
||||||
|
|
||||||
mailboxWhisperService, err := mailboxBackend.StatusNode().WhisperService()
|
mailboxWhisperService, err := mailboxBackend.StatusNode().WhisperService()
|
||||||
@ -189,9 +189,9 @@ func (s *WhisperMailboxSuite) TestRequestMessagesInGroupChat() {
|
|||||||
charlieWhisperService, err := charlieBackend.StatusNode().WhisperService()
|
charlieWhisperService, err := charlieBackend.StatusNode().WhisperService()
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
// Get rpc client.
|
// Get rpc client.
|
||||||
aliceRPCClient := aliceBackend.StatusNode().RPCClient()
|
aliceRPCClient := aliceBackend.StatusNode().RPCPrivateClient()
|
||||||
bobRPCClient := bobBackend.StatusNode().RPCClient()
|
bobRPCClient := bobBackend.StatusNode().RPCPrivateClient()
|
||||||
charlieRPCClient := charlieBackend.StatusNode().RPCClient()
|
charlieRPCClient := charlieBackend.StatusNode().RPCPrivateClient()
|
||||||
|
|
||||||
// watchers
|
// watchers
|
||||||
envelopeArchivedWatcher := make(chan whisper.EnvelopeEvent, 1024)
|
envelopeArchivedWatcher := make(chan whisper.EnvelopeEvent, 1024)
|
||||||
@ -342,7 +342,7 @@ func (s *WhisperMailboxSuite) TestRequestMessagesWithPagination() {
|
|||||||
client, stop := s.startBackend("client")
|
client, stop := s.startBackend("client")
|
||||||
defer stop()
|
defer stop()
|
||||||
s.Require().True(client.IsNodeRunning())
|
s.Require().True(client.IsNodeRunning())
|
||||||
clientRPCClient := client.StatusNode().RPCClient()
|
clientRPCClient := client.StatusNode().RPCPrivateClient()
|
||||||
|
|
||||||
// Add mailbox to clients's peers
|
// Add mailbox to clients's peers
|
||||||
errCh := helpers.WaitForPeerAsync(client.StatusNode().Server(), mailboxEnode, p2p.PeerEventTypeAdd, time.Second)
|
errCh := helpers.WaitForPeerAsync(client.StatusNode().Server(), mailboxEnode, p2p.PeerEventTypeAdd, time.Second)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user