After updating to the newest 7.x-2.2 release the logs are filling up with the following:

Notice: Undefined index: expires in tfa_entry_access() (line 40 of tfa.module).

CommentFileSizeAuthor
#2 tfa-n3318879-2.patch486 bytesdamienmckenna

Comments

DamienMcKenna created an issue. See original summary.

damienmckenna’s picture

Status: Active » Needs review
StatusFileSize
new486 bytes

This should resolve the error, but I'm not 100% if the logic is accurate - should it fail if $context['expires'] isn't defined?

damienmckenna’s picture

FWIW the error was logged for anonymous users.

jcnventura’s picture

Status: Needs review » Reviewed & tested by the community
jcnventura’s picture

To 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.

  • 0c3afa1 committed on 7.x-2.x
    Issue #3318879 by DamienMcKenna, jcnventura: Notice: Undefined index:...
jcnventura’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.