Issue Bug Closed

#76168Impossible to set cookie with a lifetime

Robert Vock 05/12/16, 16:28 updated 10/02/18, 11:13

Description

If you configure a session lifetime, the session is valid even after the configured lifetime!

I think, this happens because of an incorrect condition in FrontendUserAuthentication::isRefreshTimeBasedCookie
https://github.com/TYPO3/TYPO3.CMS/blob/38f9382/typo3/sysext/frontend/Classes/Authentication/FrontendUserAuthentication.php#L220

This check only returns true, if ses_permanent is true and lifetime > 0.

Steps to reproduce:
1. $GLOBALS[‘TYPO3_CONF_VARS’][‘FE’][‘lifetime’] = 2; // seconds
2. Login
3. Wait 5 Seconds and load a protected page.
4. You are still logged in!

Note: Step 2 sets the following Cookie:

Set-Cookie:fe_typo_user=3d4d4301904af54a52730256a926b1b3; path=/; httponly

The cookie is generated here:
https://github.com/TYPO3/TYPO3.CMS/blob/38f9382/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php#L483

Additionally the property auth_timeout_field will prevent a lower session timeout than 6000 seconds in TYPO3 7.6. I think this has been fixed with #68890 but this has not been merged TYPO3 7.

Reviews 2