-
-
Notifications
You must be signed in to change notification settings - Fork 6
Improve safety of CaveatBuilder interface #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- rename allowEmptyCaveats to allowInsecureFullAuthorityDelegations - require allowInsecureFullAuthorityDelegations when signing and creating delegations
d350250
to
420b110
Compare
420b110
to
f002d56
Compare
hanzel98
reviewed
Jul 9, 2025
packages/delegation-toolkit/src/caveatBuilder/erc1155BalanceChangeBuilder.ts
Outdated
Show resolved
Hide resolved
hanzel98
reviewed
Jul 9, 2025
hanzel98
reviewed
Jul 9, 2025
packages/delegation-toolkit/test/caveatBuilder/blockNumberBuilder.test.ts
Show resolved
Hide resolved
hanzel98
reviewed
Jul 9, 2025
packages/delegation-toolkit/src/caveatBuilder/exactCalldataBuilder.ts
Outdated
Show resolved
Hide resolved
hanzel98
previously approved these changes
Jul 9, 2025
hanzel98
approved these changes
Jul 9, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📝 Description
Improves the safety of the caveat builder interface, to reduce the likelihood of insufficiently restricted delegations being signed.
🔄 What Changed?
List the specific changes made:
allowEmptyCaveats
toallowInsecureUnrestrictedDelegation
allowInsecureUnrestrictedDelegation
when creating and signing delegations with no caveatscalldata
parameter in @metamask/delegation-core (previously included somecallData
parameters)🚀 Why?
This is the first in a number of changes aimed at reducing the likelihood of insufficiently restricted delegations being created and signed.
allowInsecureUnrestrictedDelegation
is a more meaningful flag thanallowEmptyCaveats
, and stands out as a red flag to developers.🧪 How to Test?
Describe how to test these changes:
allowInsecureUnrestrictedDelegation
and expect success.allowInsecureUnrestrictedDelegation
and expect success.There is good existing and new unit test coverage over this functionality.
allowInsecureUnrestrictedDelegation
must be passed to emptycaveatBuidlers
, calls tocreateDelegation
andsignDelegation
📋 Checklist
Check off completed items:
🔗 Related Issues
Link to related issues:
Closes #
Related to #
📚 Additional Notes
Code snippet for each caveat builder
Allowed Calldata
Allowed Methods
Allowed Targets
Args Equality Check
Block Number
Deployed
ERC1155 Balance Change
ERC20 Balance Change
ERC20 Period Transfer
ERC20 Streaming
ERC20 Transfer Amount
ERC721 Balance Change
ERC721 Transfer
Exact Calldata
Exact Calldata Batch
Exact Execution
Exact Execution Batch
ID
Limited Calls
Multi Token Period
Native Balance Change
Native Token Payment
Native Token Period Transfer
Native Token Streaming
Native Token Transfer Amount
Nonce
Ownership Transfer
Redeemer
Specific Action ERC20 Transfer Batch
Timestamp
Value LTE