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 = ":0"
|
||||
|
||||
// APIModules is a list of modules to expose via any type of RPC (HTTP, IPC, in-proc)
|
||||
// we also expose 2 limited personal APIs by overriding them in `api/backend.go`
|
||||
APIModules = "eth,net,web3,shh,shhext,peer"
|
||||
// APIModules is a list of modules to expose via HTTP and `CallRPC()` binding.
|
||||
// We also expose all handlers registered with `rpc.Client.RegisterHandler` to `CallRPC()` binding.
|
||||
APIModules = "eth,net,web3,peer"
|
||||
|
||||
// SendTransactionMethodName defines the name for a giving transaction.
|
||||
SendTransactionMethodName = "eth_sendTransaction"
|
||||
|
|
|
@ -130,7 +130,7 @@ func (s *RPCTestSuite) TestCallRawResult() {
|
|||
|
||||
s.NoError(s.StatusNode.Start(nodeConfig))
|
||||
|
||||
client := s.StatusNode.RPCClient()
|
||||
client := s.StatusNode.RPCPrivateClient()
|
||||
s.NotNil(client)
|
||||
|
||||
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) {
|
||||
config.RPCEnabled = true
|
||||
config.AddAPIModule("shhext")
|
||||
})
|
||||
defer s.StopTestNode()
|
||||
|
||||
client := s.StatusNode.RPCClient()
|
||||
client := s.StatusNode.RPCPrivateClient()
|
||||
r.NotNil(client)
|
||||
|
||||
// This error means that the method is available through inproc communication
|
||||
|
|
|
@ -62,7 +62,7 @@ func (s *WhisperExtensionSuite) TestSentSignal() {
|
|||
}
|
||||
})
|
||||
defer signal.ResetDefaultNodeNotificationHandler()
|
||||
client := s.nodes[0].RPCClient()
|
||||
client := s.nodes[0].RPCPrivateClient()
|
||||
s.NotNil(client)
|
||||
var symID string
|
||||
s.NoError(client.Call(&symID, "shh_newSymKey"))
|
||||
|
@ -102,7 +102,7 @@ func (s *WhisperExtensionSuite) TestExpiredSignal() {
|
|||
}
|
||||
})
|
||||
defer signal.ResetDefaultNodeNotificationHandler()
|
||||
client := s.nodes[0].RPCClient()
|
||||
client := s.nodes[0].RPCPrivateClient()
|
||||
s.NotNil(client)
|
||||
var symID string
|
||||
s.NoError(client.Call(&symID, "shh_newSymKey"))
|
||||
|
|
|
@ -74,7 +74,7 @@ func (s *WhisperMailboxSuite) TestRequestMessageFromMailboxAsync() {
|
|||
MailServerKeyID, err := senderWhisperService.AddSymKeyFromPassword(password)
|
||||
s.Require().NoError(err)
|
||||
|
||||
rpcClient := sender.StatusNode().RPCClient()
|
||||
rpcClient := sender.StatusNode().RPCPrivateClient()
|
||||
s.Require().NotNil(rpcClient)
|
||||
|
||||
mailboxWhisperService, err := mailboxBackend.StatusNode().WhisperService()
|
||||
|
@ -189,9 +189,9 @@ func (s *WhisperMailboxSuite) TestRequestMessagesInGroupChat() {
|
|||
charlieWhisperService, err := charlieBackend.StatusNode().WhisperService()
|
||||
s.Require().NoError(err)
|
||||
// Get rpc client.
|
||||
aliceRPCClient := aliceBackend.StatusNode().RPCClient()
|
||||
bobRPCClient := bobBackend.StatusNode().RPCClient()
|
||||
charlieRPCClient := charlieBackend.StatusNode().RPCClient()
|
||||
aliceRPCClient := aliceBackend.StatusNode().RPCPrivateClient()
|
||||
bobRPCClient := bobBackend.StatusNode().RPCPrivateClient()
|
||||
charlieRPCClient := charlieBackend.StatusNode().RPCPrivateClient()
|
||||
|
||||
// watchers
|
||||
envelopeArchivedWatcher := make(chan whisper.EnvelopeEvent, 1024)
|
||||
|
@ -342,7 +342,7 @@ func (s *WhisperMailboxSuite) TestRequestMessagesWithPagination() {
|
|||
client, stop := s.startBackend("client")
|
||||
defer stop()
|
||||
s.Require().True(client.IsNodeRunning())
|
||||
clientRPCClient := client.StatusNode().RPCClient()
|
||||
clientRPCClient := client.StatusNode().RPCPrivateClient()
|
||||
|
||||
// Add mailbox to clients's peers
|
||||
errCh := helpers.WaitForPeerAsync(client.StatusNode().Server(), mailboxEnode, p2p.PeerEventTypeAdd, time.Second)
|
||||
|
|
Loading…
Reference in New Issue