yiisoft / yiisoft/user

CurrentUser::$absoluteAuthTimeout logic is not compatible with auto-login cookie

Open
#112 22 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
23
Forks
7
Avg merge
1d 18h
Merged PRs (30d)
5

Description

As I see from the code the CurrentUser::$absoluteAuthTimeout is stored as __auth_absolute_expire in PHP session only but not in cookie,
PHP session expires by default in 24 minutes, so usually auto-login cookie is used to keep sessions alive, but __auth_absolute_expire logic is not working as intended with the cookies:

if __auth_absolute_expire expires it ends current user session stored in PHP session but new user session will be created right away on the next request by CookieLoginMiddleware using the auto-login cookie,

or if a user takes a break for 24 minute the PHP session with __auth_absolute_expire will expire itself, and will be created fresh session with new __auth_absolute_expire on new request

so I think __auth_absolute_expire should be stored in cookie too to fix it

UPD and same for __auth_expire - it is not working as intended if auto-login cookie is used,
but I'm not sure if it does make sense to add __auth_expire to cookie as there is similar expire mechanism for cookie

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing CurrentUser::$absoluteAuthTimeout and __auth_expire through the PHP session and CookieLoginMiddleware auto-login path. Compare how the auto-login cookie recreates sessions after session expiry, then determine how both timeout values should behave; done means the timeout rules remain effective across cookie-based session restoration.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
authentication, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.