First good issue: Reentrancy Risk in _rentStorage Function in src/IdGateway.sol
Issue: In the _rentStorage function, the contract transfers an overpayment back to the payer using payer.sendNative(overpayment). Using send or transfer in Ethereum can be risky because it allows for potential reentrancy attacks (depending on how sendNative is implemented). If the payer is a contract, they could reenter and exploit the contract by re-calling the function in an unintended way.
Fix: The contract should implement a checks-effects-interactions pattern by ensuring all state changes are made before the external call or consider using call with safe handling.
(bool success, ) = payer.call{value: overpayment}(""); require(success, "Transfer failed");
Fixing a reentrancy risk prevents one of the most notorious attack vectors in Ethereum smart contracts.
Hi @ATella12, I would like to take on this issue and implement the fix.