L-1: Configuration values not validated when updating position settings
Summary:
The setPositionSettings Sickle function does not validate the values of the settings argument.
And the setPositionSettings function used to set reward behavior does not validate rewardConfig.
Description:
The function does not contain the checkConfigValues modifier like the related setPositionSettings owner function does.
This modifier checks the new settings values for misconfigurations as well as limits on slippage and price impact.
modifier checkConfigValues(
PositionSettings memory settings
) {
if (
settings.rewardConfig.rewardBehavior != RewardBehavior.Harvest
&& settings.rewardConfig.harvestTokenOut != address(0)
) {
revert InvalidTokenOut();
}
if (!settings.autoExit) {
if (
settings.exitConfig.triggerPriceLow != 0
|| settings.exitConfig.triggerPriceHigh != 0
|| settings.exitConfig.exitTokenOutLow != address(0)
|| settings.exitConfig.exitTokenOutHigh != address(0)
|| settings.exitConfig.slippageBP != 0
|| settings.exitConfig.priceImpactBP != 0
) {
revert AutoExitNotSet();
}
} else {
if (
settings.exitConfig.triggerPriceLow == 0
&& settings.exitConfig.triggerPriceHigh == 0
) {
revert ExitTriggersNotSet();
}
if (settings.exitConfig.slippageBP > MAX_SLIPPAGE_BP) {
revert InvalidSlippageBP();
}
if (
settings.exitConfig.priceImpactBP > MAX_PRICE_IMPACT_BP
|| settings.exitConfig.priceImpactBP == 0
) {
revert InvalidPriceImpactBP();
}
}
_;
}
Impact:
At worst, when a high value is set for slippage and/or price impact, swaps are susceptible to front-running and can lose significant value. However, the likelihood of this happening is low because the owner would have to make a mistake when setting the values.
Recommendation:
Always perform the checkConfigValues when updating the settings via the Sickle or owner.
Validate the rewardConfig argument of the setPositionSettings function used for setting reward behavior with the related logic found in checkConfigValues.
Developer Response:
Acknowledged - Fixed in #282