metamask-extension
metamask-extension copied to clipboard
Stop implementing RPC methods ahead of the permission middleware
Ref: https://github.com/MetaMask/metamask-mobile/issues/9492
Some RPC methods, e.g. wallet_switchEthereumChain and wallet_addEthereumChain, are implemented ahead of the permission middleware. This makes it difficult to keep track of our restricted vs. unrestricted methods, while also literally circumventing our permission system. Instead, we should reorder our json-rpc-engine middleware stack such that every method hits the permission middleware, and all unrestricted methods have to be enumerated in this list.