test Flow.flow nonReentrant guard via malicious token callback#446
test Flow.flow nonReentrant guard via malicious token callback#446thedavidmeister wants to merge 1 commit intomainfrom
Conversation
`Flow.flow` carries `nonReentrant`. A new test deploys a
`MaliciousReenteringToken` whose `transferFrom` re-enters
`flow.flow(...)` on the same flow contract and asserts that the inner
call reverts with the OZ ReentrancyGuardUpgradeable v4 string
("ReentrancyGuard: reentrant call").
Mutation verified: dropping `nonReentrant` from `Flow.flow` makes the
inner call succeed and the outer test fail; reverting passes.
The malicious token contract lives in test/concrete/ per project rule
that test helper contracts are not inlined in test files.
Closes #324 #330.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Pins
Flow.flow'snonReentrantguard. New test deploys aMaliciousReenteringTokenwhosetransferFromre-entersflow.flow(...)on the same flow contract and asserts the inner call reverts with the OZ ReentrancyGuardUpgradeable v4 string"ReentrancyGuard: reentrant call".Mutation verified: dropping
nonReentrantfromFlow.flowmakes the inner call succeed and the outer test fails (reverting withUnsupportedERC20Flowfrom a later branch instead of the reentrancy revert); reverting passes.The malicious token contract lives in
test/concrete/per the project rule that test helper contracts are not inlined in test files.This PR also resolves the empirical observation in #330 (Pass 5 mutation showed
nonReentrantremoval was uncaught by any test) by adding the test that catches it.Closes #324 #330.
Test plan
testFlowReentrancyGuardFiresOnTokenCallback— 100 fuzz runsnonReentrantfromFlow.flow→ test fails🤖 Generated with Claude Code