Closed (fixed)
Project:
Two-factor Authentication (TFA)
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 Nov 2022 at 11:14 UTC
Updated:
25 Nov 2022 at 09:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
damienmckennaThis should resolve the error, but I'm not 100% if the logic is accurate - should it fail if $context['expires'] isn't defined?
Comment #3
damienmckennaFWIW the error was logged for anonymous users.
Comment #4
jcnventuraComment #5
jcnventuraTo be honest, I think it is OK as is, as this gets rid of the warning. What is happening here is that the TFA entry form is being accessed directly and the entire context is most certainly empty. That will result in a FALSE at the end of the call, since the code that creates that context will add the expires parameter always.
Only option for that not to happen, and to have the pre-7.x-2.2 context, is that the user provided the user+pass when the site was running tfa 7.x-2.1, but it now uses tfa 7.x-2.2, when the redirect to the TFA entry form happens. If he has that context, then the access checks of 2.1 still apply to him, and as long as he has that session open he's free to try to brute-force the TFA form. He's got a short time window while each code is valid, and a flood mechanism in place that will lock him out after a few tries.
In summary: the proposed patch fixes the warning, but doesn't adequately safeguard the extremely rare case where user+pass is inserted before the update, but the access to the TFA form on the same browser session is already on the new code.
I'll keep this open a while longer while still RTBC, and if you want to try improving it with a
|| empty($context['expires']), and test it, the code would be a tad better.Comment #7
jcnventura