-
Notifications
You must be signed in to change notification settings - Fork 25
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
[5/n permissions] feat: add erc20 token limit plugin #72
[5/n permissions] feat: add erc20 token limit plugin #72
Conversation
04f7b56
to
a8b4b8b
Compare
224b9d6
to
3da0f37
Compare
a8b4b8b
to
f8bc912
Compare
3da0f37
to
9bb72f9
Compare
f8bc912
to
b957137
Compare
9bb72f9
to
df3870d
Compare
b957137
to
32d5467
Compare
df3870d
to
f0f72e0
Compare
32d5467
to
dcd5cd4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as #71 , quick thoughts for now:
executeCalldata.offset := add(relativeOffset, 32) | ||
executeCalldata.length := calldataload(relativeOffset) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is vulnerable to manipulation because unlike abi.decode
, this doesn't check the bounds of the offset or length - you could pass an offset that points to something invalid in the outer calldata, but points to something valid in inner calldata. E.g. the add(...)
operations are unchecked, so you could use large numbers to effective subtract an offset, rather than add, and get varying behavior between the checking plugin and the actual receiving token contract.
Might be fine for now with some warnings, or we could just switch these to be abi.decode
instead. As a sample, we don't have to worry too much about gas.
if (spend > limit) { | ||
revert ExceededNativeTokenLimit(); | ||
} | ||
limits[msg.sender][token][functionId] = limit - spend; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This linter warning is curious - I couldn't find an external function invoked before _checkAndDecrementLimit
. Do you see any?
f0f72e0
to
942de3c
Compare
dcd5cd4
to
547b99a
Compare
No description provided.