-
Notifications
You must be signed in to change notification settings - Fork 38
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
fix: [quantstamp-16] Disallow using dependencies for hooks #77
Conversation
6ecf507
to
e2c78d0
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.
Looks like a couple legit lint errors. Also left a comment on _resolveManifestFunction
.
I think this is related to the spearbit issue https://github.com/spearbit-audits/alchemy-nov-review/issues/23. In the reference implementation PR, there's an added check in Do you want to also address that here too, or spin it out into a separate PR? |
e2c78d0
to
e28efab
Compare
@adam Yup, I got that fix when following Jay's suggestion for the arguments to |
e28efab
to
e0df98f
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.
Looks good, some comments.
uint256 index = manifestFunction.dependencyIndex; | ||
if (index < dependencies.length) { | ||
return dependencies[manifestFunction.dependencyIndex]; | ||
} else { | ||
revert InvalidPluginManifest(); | ||
} |
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.
Nit:
uint256 index = manifestFunction.dependencyIndex; | |
if (index < dependencies.length) { | |
return dependencies[manifestFunction.dependencyIndex]; | |
} else { | |
revert InvalidPluginManifest(); | |
} | |
uint256 index = manifestFunction.dependencyIndex; | |
if (index < dependencies.length) { | |
return dependencies[index]; | |
} | |
revert InvalidPluginManifest(); |
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 suggestion is inconsistent with the existing code, such as the two magic value checks just below it. Also as a personal preference I prefer the current style, but I'm happy to change this and the rest of the function if this is the recommended style for this codebase.
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.
Yup makes sense. I think we've been changing things to the new style for less nesting in various places. Happy to pick this up as a part of #97 which is doing similar things.
Allowing hooks to be dependencies can lead to hooks being called in unexpected contexts, such as state-changing validation hooks being called outside of validation or one of a pre- and post-exec hook pair being called without the other. To prevent this without changing the interface from the spec, we disallow this case entirely.
e0df98f
to
b1a4f08
Compare
Allowing hooks to be dependencies can lead to hooks being called in unexpected contexts, such as state-changing validation hooks being called outside of validation or one of a pre- and post-exec hook pair being called without the other. To prevent this without changing the interface from the spec, we disallow this case entirely.