mail icon indicating copy to clipboard operation
mail copied to clipboard

Initial loading of Mail app requires refresh every time [$50 awarded]

Open koreywithak opened this issue 9 years ago • 10 comments

Steps to reproduce

  1. Go to nextcloud on the web.
  2. Click on apps and click on the mail app.
  3. Screen stays stuck loading, but if you hit refresh it will load.

Expected behaviour

It should load properly without refresh.

Actual behaviour

It never loads on the initial opening of the mail app.

Mail app

Mail app version: (see apps admin page) 0.6.2 Mailserver or service: (e.g. Outlook, Yahoo, Gmail, Exchange,...) Gmail Transport security - IMAP: (None, SSL, TLS, STARTTLS)

Transport security - SMTP: (None, SSL, TLS, STARTTLS)

Number of accounts: 1 Mail app version build date: (only if you are using a Nightly Build) N/A

Server configuration

Operating system: Ubuntu 14 Web server: nginx Database: mariadb PHP version: 7.0 Version: (see admin page) 11.0 Updated from an older version or fresh install: Migrated from 10 List of activated apps: Most of them

Client configuration

Browser: Google Chrome Operating system: Windows 7 Enterprise


The $50 bounty on this issue has been claimed at Bountysource.

koreywithak avatar Feb 24 '17 14:02 koreywithak

Hey,

I think I'm seeing the same problem daily. I don't yet know why it fails to load, according to the FF js console it's CSP blocking the scripts. However, this does not happen if I navigate from the files app to the mail app, but when the browser restores the previous tabs/sessions.

ChristophWurst avatar Feb 24 '17 14:02 ChristophWurst

FYI this also is problematic for other apps, I've seen the nc calendar having the exact same problem when I restored my FF tabs. It's really hard to reproduce, but it happens from time to time. AFAIK the CSP nonce is outdated when that happens. My current guess is that the remember-me refreshes the session, hence a new session id and a new csp nonce is generated and the old ones are invalid. cc @LukasReschke as discussed recently.

ChristophWurst avatar Jun 20 '17 09:06 ChristophWurst

Also FYI: if this happens, the direct menu aka the new apps menu on the top left does not load, hence you don't get to select any apps. It just shows the three dots.

ChristophWurst avatar Jun 26 '17 07:06 ChristophWurst

I'm still curious why people don't see that with the files app. If they did we surely would have gotten more similar reports 🤔

ChristophWurst avatar Jun 26 '17 07:06 ChristophWurst

I am seeing this behaviour when Firefox restores the session. So preparation like in the original description. Then log off without closing Firefox, reboot and log in again. Firefox is set to be autostarted and tries to restore the previous session. However the mail app won't reload and show just the header bar without any interaction possible. A reload will make it work.

foxbow avatar Aug 02 '17 09:08 foxbow

Yup, @foxbow, that's exactly what I observe on a regular basis. Happens both on desktop and FF for Android.

ChristophWurst avatar Aug 02 '17 09:08 ChristophWurst

First success after a few months: I can now reproduce the issue. It happens whenever the server throws away the session information (e.g. because the session file is removed). To reproduce this, one can use php session files and manually delete them from the filesystem. You have to reload twice to get back to a working mail app.

ChristophWurst avatar Sep 04 '17 13:09 ChristophWurst

To sum up my findings: in base.php we call OC_Response::addSecurityHeaders();, which retrieves the current csrf token and dumps all the fancy security stuff to the response. Later on, in the user session logic, we call CsrfTokenManager::refreshToken. Therefore the nonce used from this point on is different to the one set in the security headers -> 💥 .

Refreshing the token is triggered by the login with token logic here https://github.com/nextcloud/server/blob/91fc25c28c9e3bb1e2c438ab6f80af5963c178dc/lib/private/User/Session.php#L474.

ChristophWurst avatar Sep 04 '17 14:09 ChristophWurst

Potential fix in https://github.com/nextcloud/server/pull/6360 🚀

ChristophWurst avatar Sep 04 '17 15:09 ChristophWurst

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and questions.

lock[bot] avatar Nov 20 '18 17:11 lock[bot]