Laundrette::configureDependencies
contains a bug (misassigned dependencies
array) that results in the omission of Laundrette
's policy reconfiguration when the module associated with the MONEY
keycode
is updated. Laundrette
will keep working on the old module instead of the new one.
Laundrette::configureDependencies
is a function called by the Kernel
when the Laundrette
policy is activated or reconfigured. This function is supposed to ensure that the policy's dependencies on specific modules are properly set up.
However, these dependencies are not set correctly. dependencies
in Laundrette
is supposed to be a 2-element array containing the 2 different keycodes of the 2 modules the policy depends on, but in practice the first element (dependencies[0]
) is overwritten by the WEAPN
KeyCode
and the second one is left empty:
In short,
the policy (laundrette
) will not be reconfigured when moneyShelf
is upgraded to moneyVault
, and consequently
laundrette
's internal references to moneyShelf
be not be updated, it will keep using the moneyShelf
module that was supposed to be upgraded.
Notably, the impact of all this can be contained if, after the migration, the godfather (as kernel
's executor
) deactivates and then reactivates the policy:
To determine the impact, we need to consider where and how the incorrectly set up dependencies
array is used. It is passed down as a return value to Kernel
which then uses it to define 2 mappings:
These mappings will obviously be incorrect (incomplete), but the real impact unfolds when Kernel
tries to use these mappings:
Impact - where & when:
apart from Kernel::_activatePolicy
(which uses the incorrect dependencies
array from Laundrette
to set up the mappings), it is only used by Kernel::_reconfigurePolicies
which, in turn, is only relied on by Kernel::_upgradeModule
.
Impact - what:
Considering the code of Kernel::_reconfigurePolicies
below, it can be seen that if the MONEY
keycode (that has never been added to moduleDependents
, i.e. as a dependency to the policy) is provided as an input parameter (happens when the module associated with the MONEY
keycode
is being upgraded), then
-- depLength
will be 0
and configureDependencies
will never be called on the policy, so
-- policy reconfiguration never happens,
-- Laundrette
s internal references to the dependencies are not updated and, hence,
-- it will keep working with the old moneyShelf
module.
Notably, the impact of all this can be contained if, after the migration, the godfather (as kernel
's executor
) deactivates and then reactivates the policy.
Impact - where & when: getDependentIndex
is only used by Kernel::_pruneFromDependents
which, in turn, can only be called by Kernel::_deactivatePolicy
.
Impact - what: none.
Place the following test to Laundrette.t.sol
to demonstrate that
the policy is not reconfigured after an update from module moneyShelf
to moneyVault
,
the policy keeps working on moneyShelf
and not on moneyVault
after the upgrade,
the issue can be mitigated if the godfather deactivates the policy than activates it again.
Manual review, Foundry.
Correct Laundrette::configureDependencies
as follows:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.