magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.48k stars 9.29k forks source link

Admin Session Clean Expired Sessions does not use config value #33656

Open Quazz opened 3 years ago

Quazz commented 3 years ago

Preconditions (*)

  1. Magento 2.4.2

Steps to reproduce (*)

  1. Have admin session lifetime configured as a value greater than 86400s. (May be 1 year's seconds or something like that)
  2. Create admin session by logging in on admin panel
  3. Wait >86400s (but lesser than the seconds that is set in step1).
  4. Run crontask security_clean_admin_expired_sessions (which calls method cleanExpiredSessions)
  5. Admin sessions gets cleaned.

Expected result (*)

  1. Admin session cleaning uses config value, allowing sessions to stick around even when older than 86400s

Actual result (*)

  1. Admin session cleaning uses class constant of 86400s as a limit

Additional Information

  1. Update the Admin Session Lifetime (seconds), please find the below screenshot:

image

  1. Wait for > 86400
  2. Run cron security_clean_admin_expired_sessions

Terminal

  1. Check the admin panel if it is logged in or not: Magento-Admin - Logout

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

(not sure on severity, it forces you to log back in, which is annoying but not critical I suppose)

m2-assistant[bot] commented 3 years ago

Hi @Quazz. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

m2-assistant[bot] commented 3 years ago

Hi @engcom-Delta. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-Delta commented 3 years ago

Hi @Quazz, We tried to reproduce the issue but need more details on step# 4 "Call admin session cleaner function". it would be great if you can specify method signature, calling methods.

Thanks

Quazz commented 3 years ago

Hi @Quazz, We tried to reproduce the issue but need more details on step# 4 "Call admin session cleaner function". it would be great if you can specify method signature, calling methods.

Thanks

I have edited the issue with more precise steps.

To clarify:

The bug seems to come from: https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Security/Model/AdminSessionsManager.php#L279

Simple enough fix would be to change it to be more like: https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Security/Model/AdminSessionsManager.php#L112 of the same class

As far as I understand, a session should only be considered expired if the admin session lifetime threshold has been met, not any sooner.

m2-assistant[bot] commented 3 years ago

Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

Quazz commented 3 years ago

Something I forgot (didn't think about it).

I suppose this also means it won't clean the sessions if the session timer is defined as SMALLER than the constant.

engcom-Hotel commented 2 years ago

Hello @Quazz,

We have tried to reproduce the issue and the issue is reproducible. Hence confirming the issue.

I have also updated the description with additional information.

Thanks

github-jira-sync-bot commented 2 years ago

:white_check_mark: Jira issue https://jira.corp.magento.com/browse/AC-1458 is successfully created for this GitHub issue.

m2-assistant[bot] commented 2 years ago

:white_check_mark: Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.