feat(scanner): implement Unchecked Return Value detection plugin (#16) - #106
Open
Rushikeshiitb wants to merge 1 commit into
Open
feat(scanner): implement Unchecked Return Value detection plugin (#16)#106Rushikeshiitb wants to merge 1 commit into
Rushikeshiitb wants to merge 1 commit into
Conversation
Implements an IRulePlugin that flags low-level calls (address.call, address.send, address.delegatecall) whose boolean return value is ignored, and recommends the require(success) pattern. Registers the plugin via createDefaultRegistry in scanner-core. Closes VeridionLabs#16 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
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.
Summary
Implements the Unchecked Return Value detection plugin requested in #16.
The plugin flags low-level calls whose boolean return value is ignored —
address.call(...),address.send(...), andaddress.delegatecall(...)— since these do not revert on failure and a silently-droppedfalsecan leave a contract in an inconsistent state (SWC-104).Files created
plugins/unchecked-return/package.jsonplugins/unchecked-return/tsconfig.jsonplugins/unchecked-return/vitest.config.tsplugins/unchecked-return/.eslintrc.jsplugins/unchecked-return/src/index.tsplugins/unchecked-return/src/index.test.tsFiles modified
packages/scanner-core/src/plugin-registry.ts— addscreateBuiltinPlugins()/createDefaultRegistry()that register the new plugin.packages/scanner-core/package.json+pnpm-lock.yaml— workspace dependency wiring.Behaviour
.call()/.call{...}(),.send(), and.delegatecall()return values.(bool ok, ) = ...,bool ok = ...) or consumed byrequire/assert/if/while/return/boolean operators.getFixRecommendation()returns therequire(success)remediation pattern.Acceptance criteria
IRulePluginfrom@veridion/scanner-typesaddress.call()return valuesaddress.send()return valuesaddress.delegatecall()return valuesrequire(success)patternTesting
Closes #16
🤖 Generated with Claude Code