MetaMask / rpc-cap

A module for adding an object-capabilities system to any JSON-RPC API as middleware for json-rpc-engine
ISC License
31 stars 32 forks source link

Add params subset caveat, fix name of superset caveat #128

Closed rekmarks closed 3 years ago

rekmarks commented 3 years ago

After merging #127, I realized that I repeated the same mistake I made in #61, which was reverted in #64.

The caveat formerly known as requireParams enforces that the request parameters are a superset of the caveat value, and that is the intended behavior. That is clearly very confusing for me, so that caveat is now renamed to requireParamsIsSuperset.

This PR reverts the renaming of the superset caveat done in #127, and creates a new requireParamsIsSubset caveat, that actually requires that the request parameters are a subset of the caveat value.

Tests have been added.