erc6900 / resources

19 stars 4 forks source link

[Improvement] Support for temporary runtime permissions #33

Open noam-alchemy opened 6 months ago

noam-alchemy commented 6 months ago

Support per-use permissions where the account requires explicit permission in UserOp.calldata for certain operations, so the user is made aware that the transaction is doing something that requires elevated privilege of some sort.

e.g.

require(someSpecialPermissionAppendedToCallData, "SpecialPermission needed")

When the wallet simulates the transaction without the user appending this SpecialPermission, the simulation reverts with "SpecialPermission needed" so the user cannot be tricked to do something that requires this permission without explicitly agreeing to it. On the wallet side, it'll see this revert in pre-signing simulation, append SpecialPermission to calldata and prompt the user to sign with it. The user is informed that the transaction requires a special permission such as ChangeOwnership.

For critical things like changing permission, it makes sense to require this explicit permission and ensure that there's no way to ever trigger these operations accidentally through some other operation.

adamegyed commented 2 months ago

The per-hook data PR makes this workflow possible via pre-validation hooks, but it does not yet contain an example of this workflow. We should add an example to the reference implementation before marking this as complete.