-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Description
⚠️ This issue respects the following points: ⚠️
- This is a bug, not a question or a configuration/webserver/proxy issue.
- This issue is not already reported on Github OR Nextcloud Community Forum (I've searched it).
- Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- I agree to follow Nextcloud's Code of Conduct.
Bug description
When my colleagues and I are trying to log into our Nextcloud instance, we cannot do so without clearing our browser cache. If we did not clear our cache before accessing the site, we would land in an endless loop. The issue only happens with Firefox-based browsers (and not even all of them). It was tested with all browser extensions disabled, just in case.
Behavior/To reproduce
- Have a valid session the last time the browser was open. (yesterday, before lunch, ...)
- Open the browser, go to the base URL, get redirected to
/login - Enter credentials -> the
POST /loginrequest results in a redirect to/login/selectchallengesince we enforce MFA - Select an MFA method (We use TOTP and WebAuthn, the issue happens with both)
- This results in the browser making a
GET /login/challenge/totprequest (in the case of TOTP) -> The server responds with a redirect to/login?redirect_url=/login/challenge/totpand we are back on the login page ¯_(ツ)_/¯
If we repeat this, the response from the server will always append the redirect_url parameter. So after the 2nd cycle, we end up on /login?redirect_url=/login/challenge/totp?redirect_url%3D/login/challenge/totp.
After some debugging, I landed in lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php due to the debug log printing:
"File":"/var/www/html/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php","Line":134,"message":"Current user is not logged in","exception":{},"CustomMessage":"Current user is not logged in"
In there, we get a NotLoggedInException because $authorized is false. Somehow, we fail the condition.
if ($this->userSession instanceof Session && $this->userSession->getSession()->get('app_api') === true && $this->userSession->getUser() === null) {
$authorized = true;
}Because I saw that app_api is somehow involved in this, I re-enabled the AppApi extension... and voila! It works again.
Do not ask me why this only happens with Firefox and not Chrome. Maybe a local cache issue since Nextcloud tries to re-establish a session with previous cookies/session data?
Steps to reproduce
See above
Expected behavior
A normal login flow (get prompted for MFA instead of a redirect to /login)
Nextcloud Server version
32
Operating system
Debian/Ubuntu
PHP engine version
None
Web server
None
Database engine version
None
Is this bug present after an update or on a fresh install?
None
Are you using the Nextcloud Server Encryption module?
None
What user-backends are you using?
- Default user-backend (database)
- LDAP/ Active Directory
- SSO - SAML
- Other
Configuration report
List of activated Apps
Nextcloud Signing status
Nextcloud Logs
Additional info
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status