MetaMask / snaps

Extend the functionality of MetaMask using Snaps
https://metamask.io/snaps/
Other
711 stars 546 forks source link

Snaps CLI should warn or error if “endowment:rpc” object is empty #2405

Closed Montoya closed 1 week ago

Montoya commented 1 month ago

If a Snap manifest has the RPC endowment with an empty object like so:

“endowment:rpc”: {}

This will cause an error in MetaMask when attempting to connect like so: An error happened: Invalid JSON-RPC origins: Must specify at least one JSON-RPC origin

The CLI should warn that the endowment will not be functional without at least one origin such as "dapps":true

FrederikBolding commented 1 month ago

This happens because Superstruct assign doesn't copy over refinements, so when merging two structs here we lose some validation.