FeegrantKeeper is not checked if defined #12
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
insufficient quality report
This report is not of sufficient quality
🤖_primary
AI based primary recommendation
Lines of code
https://github.com/code-423n4/2024-05-canto/blob/d1d51b2293d4689f467b8b1c82bba84f8f7ea008/canto-main/app/ante/handler_options.go#L39-L57
Vulnerability details
Impact
The Validate function will not revert when FeegrantKeeper is nil
Proof of Concept
Here's the Validate function:
// Validate checks if the keepers are defined func (options HandlerOptions) Validate() error { if options.AccountKeeper == nil { return errorsmod.Wrap(sdkerrors.ErrLogic, "account keeper is required for AnteHandler") } if options.BankKeeper == nil { return errorsmod.Wrap(sdkerrors.ErrLogic, "bank keeper is required for AnteHandler") } if options.SignModeHandler == nil { return errorsmod.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder") } if options.FeeMarketKeeper == nil { return errorsmod.Wrap(sdkerrors.ErrLogic, "fee market keeper is required for AnteHandler") } if options.EvmKeeper == nil { return errorsmod.Wrap(sdkerrors.ErrLogic, "evm keeper is required for AnteHandler") } return nil }
https://github.com/code-423n4/2024-05-canto/blob/d1d51b2293d4689f467b8b1c82bba84f8f7ea008/canto-main/app/ante/handler_options.go#L39-L57
The function does not check if FeegrantKeeper is not nil. Therefore the function will not return an error when FeegrantKeeper is nil.
Tools Used
Manual review
Recommended Mitigation Steps
It's recommended to add a check for the FeeGrantKeeper in the Validate function, similar to the checks for other keepers.
if options.FeegrantKeeper == nil {
return errorsmod.Wrap(sdkerrors.ErrLogic, "fee grant keeper is required for AnteHandler")
}
Assessed type
Context
The text was updated successfully, but these errors were encountered: