Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression - Sessions are expiring too fast #14149

Closed
nunoperalta opened this issue Apr 1, 2018 · 34 comments · Fixed by #15872
Closed

Regression - Sessions are expiring too fast #14149

nunoperalta opened this issue Apr 1, 2018 · 34 comments · Fixed by #15872
Assignees
Labels
enhancement A feature request for improving phpMyAdmin good first issue has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete ui Issues relating to the user interface
Projects
Milestone

Comments

@nunoperalta
Copy link

Steps to reproduce

  1. Stay ~1 hour inactive (not focusing the phpMyAdmin tab)
  2. Click a link
  3. Your session is expired

Expected behaviour

Stay log in for as long as your setting "Login cookie validity" says.
My setting is "604800", but my session is expiring in ~1 hour (can't know exact time)

This was working in 4.7.8.

Actual behaviour

Logging out / session expires too fast

Server configuration

Operating system: CentOS

Web server: Apache

Database: MariaDB

PHP version: 7.2

phpMyAdmin version: 4.7.9

Client configuration

Browser: Chrome 52

Operating system: Win 10

@mastrobirraio
Copy link

To increase the phpMyAdmin Session Timeout, open config.inc.php in the root phpMyAdmin directory and add this setting (anywhere).

$cfg['LoginCookieValidity'] = <your_new_timeout>;
Where <your_new_timeout> is some number larger than 1800.

@nunoperalta
Copy link
Author

Hello,

Like I said above, my Login Cookie Validity is 604800, and has been working well in previous versions of phpMyAdmin.

Thank you.

@nunoperalta
Copy link
Author

nunoperalta commented Apr 7, 2018

In 4.8.0, it appears that the LoginCookieValidity setting has disappeared from the Settings (or at least I don't seem to be able to find), so I've just added the following to the config file:

$cfg['LoginCookieValidity'] = 604800;

I'll let you know if this resolves the issue.

@nunoperalta
Copy link
Author

Hello,

I confirm that sessions are still expiring quickly, even though I added the above configuration.

Versions affected: 4.7.9, 4.8.0

Thank you.

@nunoperalta
Copy link
Author

nunoperalta commented May 31, 2018

This might be because Sessions are expiring because of "session.gc_maxlifetime".

However, pretty sure that this was working before 4.7.9, even if gc_maxlifetime was small.

I don't want to be changing the global session max life time just because of phpMyAdmin.

Isn't phpMyAdmin supposed to keep me alive for as long as I have a window/tab open, with background requests?

It appears that was implemented not so long ago... #6229 #1355

Was that reverted?

@williamdes
Copy link
Member

/**
* validity of cookie login (in seconds; 1440 matches php.ini's
* session.gc_maxlifetime)
*
* @global integer $cfg['LoginCookieValidity']
*/
$cfg['LoginCookieValidity'] = 1440;

@nunoperalta Do you have the following warning ?
warning

@williamdes williamdes added the question Used when we need feedback from the submitter or when the issue is a question about PMA label Nov 30, 2018
@nunoperalta
Copy link
Author

I don't have any warnings appearing in the homepage.
Thank you.

@williamdes
Copy link
Member

@nunoperalta do you still have this issue ?

@williamdes williamdes added this to Triage zone in Enhancements Jan 23, 2020
@williamdes williamdes added this to Needs triage in Questions via automation Jan 23, 2020
@williamdes williamdes removed this from Triage zone in Enhancements Jan 23, 2020
@williamdes williamdes moved this from Needs triage to Needs a second check to be a bug in Questions Jan 23, 2020
@nunoperalta
Copy link
Author

nunoperalta commented Jan 24, 2020

Since long ago, this seems to be a lot more stable.

However, I think that since 5.0.0, when the session expires, the page goes to the logged out page automatically, while before, it stayed on the same page until I do something first (e.g. press a button).

This is not fully confirmed yet, but I can try to find whether this is the case or not.

@nunoperalta
Copy link
Author

Yup - definitely happening. I left the page open during the night, and now in the morning, I lost what I had opened.

I don't mind having some alert somewhere saying the session is expired, but I'd prefer if I didn't lose the page that was previously open.

image

@williamdes
Copy link
Member

Thank your for the testing.
I need to do some research but it is possible that the php sessions expire more quickly than we defined in $cfg['LoginCookieValidity'] = 604800;

@williamdes williamdes added the Bug A problem or regression with an existing feature label Jan 24, 2020
@yashrajbothra
Copy link
Contributor

I don't mind having some alert somewhere saying the session is expired, but I'd prefer if I didn't lose the page that was previously open.

Did you mean after log-in you should be on same page ?

@nunoperalta
Copy link
Author

Guys,

For sure, the time the session takes to expire isn't the problem for me anymore. I think it's simply the definition in "session.gc_maxlifetime", which is ok for me. (definitely improved since I reported this bug)

However, the fact that now phpMyAdmin kicks me off automatically from every open tab, redirecting all tabs to the Log In page is the problem for me.

Before 5.0.0, the session expired, but the page stayed open until I click a button or navigate.
At least I knew what was open on the tab and I could go again to the same place.

Now, I come back to work after many hours, and I have many tabs all redirected to the Log In page, and have no idea what I was doing before on each tab.

What would be nice is that when phpMyAdmin detects the session expired, do NOT redirect me automatically, but instead just show a popup saying (more or less these words - this is just a draft):

Your session has expired. Press "Log In" to leave this page and log in again, or press "Stay" to stay in this page. If you navigate or press any button, you will lose your changes and be required to log in again.

@williamdes
Copy link
Member

What would be nice is that when phpMyAdmin detects the session expired, do NOT redirect me automatically, but instead just show a popup saying

@nunoperalta I think what you are asking for was implemented in #14313 but maybe does not work in your case

@nunoperalta
Copy link
Author

Strange... I have never seen a popup about being logged out, in phpMyAdmin.
Surprised it was implemented in 2018...

Either I see nothing and I am being redirected as soon as I do something on the current page, or now with 5.0.0, I am automatically redirected without notice.

@yashrajbothra
Copy link
Contributor

Don't Worry @nunoperalta I will test this issue and let you know 👍

@williamdes williamdes added this to Needs triage in issues via automation Jan 24, 2020
@williamdes williamdes removed this from Needs a second check to be a bug in Questions Jan 24, 2020
@williamdes williamdes moved this from Needs triage to To be sorted in issues Jan 24, 2020
@yashrajbothra
Copy link
Contributor

image
As @nunoperalta said there was no popup shown up 😕

@yashrajbothra
Copy link
Contributor

Ohh sorry Actully this is a model but covering the whole page so cant really say that its a model
image

@yashrajbothra
Copy link
Contributor

the functionality is fine though 👍

UI could be little better i guess?

@williamdes
Copy link
Member

@yashrajbothra are you sure to have tested the case where session.gc_maxlifetime < $cfg['LoginCookieValidity']

In that case does the modal work as good ?

@yashrajbothra
Copy link
Contributor

yashrajbothra commented Jan 24, 2020

@williamdes Yes, It works even in that case but it doesnt work as desired.

Like the session.gc_maxlifetime=200 and $cfg['LoginCookieValidity'] = 120; but the automatic logout performed after image (about 300 seconds)

@nunoperalta
Copy link
Author

Ok - I got the login page today.

It's definitely an overlay, and I see I was back to the same page as before, without a page reload.

I'm 100% ok with this.

However, I think it would be nice if the overlay could say something like:

"You haven't lost your changes."

or

"You will go back to where you left off."

Whatever most appropriate sentence. At least this gives the security to the user that phpMyAdmin didn't inconveniently kick the user out of the page!

For example, what I was doing was closing the page and opening a new one, because I was afraid that if my last page was some UPDATE or ALTER TABLE, reloading the page after a login could potentially re-run that query... (we never know!!)

So, I was playing safe, not realizing that this was a safe way to login, without losing anything.

Hope you consider this small change :)

Thanks!

@yashrajbothra
Copy link
Contributor

Ya either way if we keep the opacity low then user can see his work in background and he will know the works is not lost 👍

@ibennetch
Copy link
Member

ibennetch commented Jan 27, 2020 via email

@williamdes
Copy link
Member

williamdes commented Jan 27, 2020

then a malicious user walks past the desk

Malicious but not clever, he could use inspect tool and remove the modal ^^
That said, a high blur effect could hide every readable details .

As a result, I'd prefer an additional notification message to be displayed
saying something like "You have been automatically logged out due to
inactivity. Once you log in again, you should be able to resume working
where you left off." — what do you think?

I agree, and it would be QA_5_0 compatible.
Do you agree for this change to go to QA_5_0 @ibennetch ?

@yashrajbothra
Copy link
Contributor

I think just leaving a message is better than showing some confidential info in background.
Ya ,they can delete modal by inspecting but atleast we should protect as much as we can 👍

@ibennetch
Copy link
Member

ibennetch commented Jan 27, 2020 via email

@nunoperalta
Copy link
Author

nunoperalta commented Jan 27, 2020

Worst case scenario, we can probably have a Setting where the admin can choose whether to fully logout (with a redirect) for security purposes, or have a modal which is less secure.

I would choose the less secure setting, because I don't log into my databases using public computers or mobile devices... and I don't want to lose my work overnight.

@williamdes williamdes added this to the 5.0.2 milestone Jan 27, 2020
@williamdes williamdes added enhancement A feature request for improving phpMyAdmin good first issue ui Issues relating to the user interface and removed question Used when we need feedback from the submitter or when the issue is a question about PMA labels Jan 27, 2020
@williamdes
Copy link
Member

Worst case scenario, we can probably have a Setting where the admin can choose whether to fully logout (with a redirect) for security purposes, or have a modal which is less secure.

It could be a good idea to have a setting 👍

First we can start with a message, and add the setting in another PR

@yashrajbothra
Copy link
Contributor

So far i have good understanding of the issue so i think i can take this up. Can I @williamdes ??

@williamdes
Copy link
Member

Yes @yashrajbothra you can take it

yashrajbothra added a commit to yashrajbothra/phpmyadmin that referenced this issue Jan 28, 2020
Signed-off-by: Yash Bothra <yashrajbothra786@gmail.com>
@williamdes williamdes added the has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete label Jan 28, 2020
yashrajbothra added a commit to yashrajbothra/phpmyadmin that referenced this issue Jan 28, 2020
Signed-off-by: Yash Bothra <yashrajbothra786@gmail.com>
yashrajbothra added a commit to yashrajbothra/phpmyadmin that referenced this issue Jan 29, 2020
Signed-off-by: Yash Bothra <yashrajbothra786@gmail.com>
yashrajbothra added a commit to yashrajbothra/phpmyadmin that referenced this issue Jan 30, 2020
Signed-off-by: Yash Bothra <yashrajbothra786@gmail.com>
yashrajbothra added a commit to yashrajbothra/phpmyadmin that referenced this issue Jan 30, 2020
Signed-off-by: Yash Bothra <yashrajbothra786@gmail.com>
yashrajbothra added a commit to yashrajbothra/phpmyadmin that referenced this issue Feb 1, 2020
Signed-off-by: Yash Bothra <yashrajbothra786@gmail.com>
@williamdes williamdes removed the Bug A problem or regression with an existing feature label Feb 22, 2020
@williamdes williamdes modified the milestones: 5.0.2, 5.1.0 Feb 22, 2020
@williamdes williamdes self-assigned this May 2, 2020
issues automation moved this from To be sorted to Closed May 2, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement A feature request for improving phpMyAdmin good first issue has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete ui Issues relating to the user interface
Projects
issues
  
Closed
Development

Successfully merging a pull request may close this issue.

5 participants