-
Notifications
You must be signed in to change notification settings - Fork 12.4k
ERC7579: prevent installing/uninstalling without proper initData #5974
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
Amxx
merged 4 commits into
master
from
feature/prevent-fallback-module-install-uninstall-without-selector
Oct 7, 2025
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
Oops, something went wrong.
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.
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 just realized that
isValidSignatureis already avoiding that this function is called with a signature that's less than 20 bytes long:I would suggest reverting this change and just noting that the function does expect a signature of at least 20 bytes. Otherwise this will add an extra (and arguably unnecessary) check.
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.
_extractSignatureValidatoris internal (and not private) so it may be called with inputs that are smaller than 20 bytes.address(bytes20(signature[0:20])). The creation of that slice is the part checks the length, and cause a panic if the input is not long enough.The proposal was to skip creation of the slice, and therefore remove the check that can trigger a panic, and do a require instead:
This avoid duplicating the check.
In both cases we would do the check only once. Currently the check is implicit (in the slice) and cause a panic. The example above (from 6c8aaca) made that check explicit, with a custom error.
There is a third option with no checks at all, but it doesn't correspond to the current code, and I would argue we should not do it because the function is internal and may be called with invalid inputs.
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.
Actually, I just realized that the right part
signature[20:]also performs a check. Creation of the slice will fail if the signature is not long enough.So maybe we want to do
without the require, and rely on the right part to cause the panic.
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.
Yes! However I thought it could be addressed by documentation exclusively. Right now it's not used on a situation where a signature of less than 20 bytes is passed in, so I thought the right approach was to note it.
Yeah, I also preferred the implicit check when accessing the slice to keep a panic code and felt the custom error was too opinionated.
This makes sense to me!