Repository navigation
Description
Actual behaviour
The latest version of android app 2.3.0 with little customization installs as usual but:
1-when connected to an account on owncloud 10 with php 7/7.1/5.6 automatically logs out after few hours of inactivity on the app and after that even if you give the correct password it will not login unless you uninstall the app and reinstall it.
2-When connected to an account on owncloud 9.1.0 with php 5.6/5.5 it does not log out.
This occurs when the app is installed from playstore only, this does not happen when installed directly.
Expected behaviour
Once logged into the app, it should remain logged in.
Steps to reproduce
- Build owncloud android 2.3.0 with basic changes in logo and setup.xml
- upload to playstore and install on android phone from playstore
- Add owncloud account which is running on OC 10 and another account running on OC 9.1.0
4- It will login successfully, and after few hours about 3-4 hours of inactivity.
5- Open the owncloud android app, it will logout and redirect to login screen with server url and username prefilled asking you to enter the password
6- Even if you enter the correct password it will not accept.
7-But adding a new account with different username will work.
Can this problem be reproduced with the official owncloud server?
(url: https://demo.owncloud.org, user: test, password: test)
Environment data
Android version: 6.0.1, 5.1
Device model:
Stock or customized system:
ownCloud app version: 2.3.0
ownCloud server version: 10.0.0.12
Logs
Web server error log
Insert your webserver log here
42.109.141.168 - testyg [12/May/2017:10:30:00 +0000] "GET /ocs/v1.php/cloud/capabilities?format=json HTTP/1.1" 200 4662 "-" "Mozilla/5.0 (Android) owncloud-android/2.3.0"
42.109.141.168 - testyg [12/May/2017:10:30:00 +0000] "GET /ocs/v1.php/cloud/user?format=json HTTP/1.1" 200 864 "-" "Mozilla/5.0 (Android) owncloud-android/2.3.0"
42.109.141.168 - testyg [12/May/2017:10:30:01 +0000] "GET /index.php/avatar/testyg/256 HTTP/1.1" 200 784 "-" "Mozilla/5.0 (Android) owncloud-android/2.3.0"
42.109.141.168 - testyg [12/May/2017:10:30:01 +0000] "PROPFIND /remote.php/webdav/ HTTP/1.1" 401 811 "-" "Mozilla/5.0 (Android) owncloud-android/2.3.0"
42.109.141.168 - - [12/May/2017:10:30:01 +0000] "GET /status.php HTTP/1.1" 200 1183 "-" "Mozilla/5.0 (Android) owncloud-android/2.3.0"
42.109.141.168 - - [12/May/2017:10:30:01 +0000] "PROPFIND /remote.php/webdav/ HTTP/1.1" 401 1315 "-" "Mozilla/5.0 (Android) owncloud-android/2.3.0"
42.109.141.168 - - [12/May/2017:10:30:02 +0000] "GET /status.php HTTP/1.1" 200 1183 "-" "Mozilla/5.0 (Android) owncloud-android/2.3.0"
42.109.141.168 - - [12/May/2017:10:30:02 +0000] "PROPFIND /remote.php/webdav/ HTTP/1.1" 401 1309 "-" "Mozilla/5.0 (Android) owncloud-android/2.3.0"
#### ownCloud log (data/owncloud.log)
``
Insert your ownCloud log here
{"reqId":"XNTwmVMw6Qnm8cHhHwfj","level":0,"time":"2017-05-12T16:00:01+05:30","remoteAddr":"42.109.141.168","user":"testyg","app":"webdav","method":"PROPFIND","url":"\/remote.php\/webdav\/","message":"Exception: {\"Message\":\"HTTP\\\/1.1 401 CSRF check not passed.\",\"Exception\":\"Sabre\\\\DAV\\\\Exception\\\\NotAuthenticated\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/html\\\/backup\\\/apps\\\/dav\\\/lib\\\/Connector\\\/Sabre\\\/Auth.php(146): OCA\\\\DAV\\\\Connector\\\\Sabre\\\\Auth->auth(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#1 \\\/var\\\/www\\\/html\\\/backup\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Auth\\\/Plugin.php(202): OCA\\\\DAV\\\\Connector\\\\Sabre\\\\Auth->check(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#2 \\\/var\\\/www\\\/html\\\/backup\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Auth\\\/Plugin.php(150): Sabre\\\\DAV\\\\Auth\\\\Plugin->check(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#3 [internal function]: Sabre\\\\DAV\\\\Auth\\\\Plugin->beforeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#4 \\\/var\\\/www\\\/html\\\/backup\\\/lib\\\/composer\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#5 \\\/var\\\/www\\\/html\\\/backup\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(466): Sabre\\\\Event\\\\EventEmitter->emit('beforeMethod', Array)\\n#6 \\\/var\\\/www\\\/html\\\/backup\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#7 \\\/var\\\/www\\\/html\\\/backup\\\/apps\\\/dav\\\/appinfo\\\/v1\\\/webdav.php(63): Sabre\\\\DAV\\\\Server->exec()\\n#8 \\\/var\\\/www\\\/html\\\/backup\\\/remote.php(165): require_once('\\\/var\\\/www\\\/html\\\/b...')\\n#9 {main}\",\"File\":\"\\\/var\\\/www\\\/html\\\/backup\\\/apps\\\/dav\\\/lib\\\/Connector\\\/Sabre\\\/Auth.php\",\"Line\":211,\"User\":\"testyg\"}"}
{"reqId":"p1Ry9EjrauB8MP8rPi3t","level":0,"time":"2017-05-12T16:00:01+05:30","remoteAddr":"42.109.141.168","user":"--","app":"webdav","method":"PROPFIND","url":"\/remote.php\/webdav\/","message":"Exception: {\"Message\":\"HTTP\\\/1.1 401 No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured, No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured\",\"Exception\":\"Sabre\\\\DAV\\\\Exception\\\\NotAuthenticated\",\"Code\":0,\"Trace\":\"#0 [internal function]: Sabre\\\\DAV\\\\Auth\\\\Plugin->beforeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#1 \\\/var\\\/www\\\/html\\\/backup\\\/lib\\\/composer\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#2 \\\/var\\\/www\\\/html\\\/backup\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(466): Sabre\\\\Event\\\\EventEmitter->emit('beforeMethod', Array)\\n#3 \\\/var\\\/www\\\/html\\\/backup\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#4 \\\/var\\\/www\\\/html\\\/backup\\\/apps\\\/dav\\\/appinfo\\\/v1\\\/webdav.php(63): Sabre\\\\DAV\\\\Server->exec()\\n#5 \\\/var\\\/www\\\/html\\\/backup\\\/remote.php(165): require_once('\\\/var\\\/www\\\/html\\\/b...')\\n#6 {main}\",\"File\":\"\\\/var\\\/www\\\/html\\\/backup\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Auth\\\/Plugin.php\",\"Line\":168,\"User\":false}"}
{"reqId":"NZ8NSNFjMoZOo8iWUd51","level":0,"time":"2017-05-12T16:00:02+05:30","remoteAddr":"42.109.141.168","user":"--","app":"webdav","method":"PROPFIND","url":"\/remote.php\/webdav\/","message":"Exception: {\"Message\":\"HTTP\\\/1.1 401 No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured, No 'Authorization: Basic' header found. Either the client didn't send one, or the server is misconfigured\",\"Exception\":\"Sabre\\\\DAV\\\\Exception\\\\NotAuthenticated\",\"Code\":0,\"Trace\":\"#0 [internal function]: Sabre\\\\DAV\\\\Auth\\\\Plugin->beforeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#1 \\\/var\\\/www\\\/html\\\/backup\\\/lib\\\/composer\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#2 \\\/var\\\/www\\\/html\\\/backup\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(466): Sabre\\\\Event\\\\EventEmitter->emit('beforeMethod', Array)\\n#3 \\\/var\\\/www\\\/html\\\/backup\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#4 \\\/var\\\/www\\\/html\\\/backup\\\/apps\\\/dav\\\/appinfo\\\/v1\\\/webdav.php(63): Sabre\\\\DAV\\\\Server->exec()\\n#5 \\\/var\\\/www\\\/html\\\/backup\\\/remote.php(165): require_once('\\\/var\\\/www\\\/html\\\/b...')\\n#6 {main}\",\"File\":\"\\\/var\\\/www\\\/html\\\/backup\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Auth\\\/Plugin.php\",\"Line\":168,\"User\":false}"}
Activity
DaanTry commentedon Dec 21, 2017
I have exact the same issue.
Android version: 7.0
Device model: SM-G935F
Stock or customized system: Stock
ownCloud app version: 2.5.0
ownCloud server version: 10.0.4 (on PHP 7.0.16)
Only removing and reinstalling App from Appstore resolves the issue.
jensd0e commentedon Dec 21, 2017
I guess, this isn't a new issue. Some people (including me) reported this before. Adding me here to get status-updates.
jesmrec commentedon Jan 9, 2018
we have the following opened with the same issue:
#1964
We can keep on discussing there. If you think is a different issue, please reopen
davigonz commentedon Jan 10, 2018
@jensd0e , @jesmrec are you sure this is the same issue that #2030?
@johnkj Are you using LDAP? Are you using spaces in your username? Do you notice this behaviour described by @jensd0e in the other issue?
jesmrec commentedon Jan 10, 2018
that issue refers directly to ldap or blanks but i mean that the problem is not in this set-up. Bug appears regardless LDAP is enabled or not
jensd0e commentedon Jan 10, 2018
@davigonz I'm not that sure anymore. There where two problems. Username normalization and being redirected to login screen. If username normalization would cause my problems, I would see logon errors on my windows server. But for me, logon is ok and only after login I'm redirected to login screen. In #2030 I started with problem No. 1 (username normalization) and continued with problem No. 2 (being redirected). That was a bad idea, I guess.
jesmrec commentedon Jan 10, 2018
ok, we reopen and keep the discussion alive
DaanTry commentedon Jan 10, 2018
In my case no spaces in de username and no LDAP used for authentication. Reproducability is 100%. A few days after installing the issue appears and can only be resolved by uninstalling/reinstalling the app.
davigonz commentedon Jan 15, 2018
Hi @DaanTry , thank you for your feedback, can you create a test account and send us the credentials to [email protected] so that we can try to reproduce it? Thanks
jesmrec commentedon Jan 15, 2018
@DaanTry if you send the credentials, please include a link to this issue within the email.
jesmrec commentedon Jan 15, 2018
@DaanTry credentials received, thanks a lot!!!!
gfredericks commentedon Jan 16, 2018
This has been happening to me for a week or two now. It also seems to always take exactly two logins to get it working, for some reason.
15 remaining items
PVince81 commentedon Jan 25, 2018
@davigonz it was neither SAML nor OAuth. Just the plain old password entry, probably basic auth. I don't have oauth enabled on our server.
Is the Android client sending the CSRF request header with basic auth ? I don't see why it would we needed for basic auth.
davigonz commentedon Jan 25, 2018
@PVince81 I do not see CSRF header in our requests, at least in the login ones I described above. I will send you the logs of the login flow with the headers and content for the requests/responses, maybe you notice something weird there.
PVince81 commentedon Jan 25, 2018
Let's look at the server code: https://github.com/owncloud/core/blob/v10.0.4/apps/dav/lib/Connector/Sabre/Auth.php#L166
These are the conditions that would trigger a CSRF check for any DAV call:
Now I wonder whether we really need a CSRF check for PROPFIND... Probably not. (to be discussed separately)
The core problem is likely due to some of these conditions not met in that non-reproducible scenario.
PVince81 commentedon Jan 25, 2018
ohhh... this "DAV authenticated" condition is based on a session variable.
It is possible that the session was in a weird state: the user was still logged in (because if
isLoggedIn()is false, the CSRF check is cancelled) but not DAV authenticated, maybe the session value is gone ?Maybe something happened to the session and/or the app token during the upgrade.
I have the feeling that this is related to a zombie session / zombie token, basically something that isn't cleared properly.
PVince81 commentedon Jan 25, 2018
And yet another little issue: as I said above, this CSRF check should never kick in for Android users.
We do see a user-agent check in the server code.
However my wife's user-agent says "ownCloudBeta-android/2.5.1-beta.1" but this is the server check:
I also wonder whether other users in this ticket were using a different or branded version where the user agent did not match ?
So I think we have three issues here:
DaanTry commentedon Jan 26, 2018
PVince81 commentedon Jan 26, 2018
@DaanTry are you using the beta client or a branded client ? Are you able to find the user-agent of your client from the access logs ?
From my analysis above, if the Android client is properly detected by the server it should never trigger the code path for CSRF check.
davigonz commentedon Jan 26, 2018
@PVince81 Thank you for the research
@DaanTry is using 2.5.0, as he commented in #1964 (comment), so CSRF shouldn't been triggered because of user-agent not being matched.
Other users such as @jensd0e and @pjao reported here the same redirection to login page with 2.5.0 beta 2 and 2.5.1-beta.1 respectively so it's most likely that those redirections appear because as you said above, the user-Agent check doesn't match the beta one and is triggering the CSRF check, which fails.
DaanTry commentedon Jan 26, 2018
davigonz commentedon Jan 26, 2018
@DaanTry in this comment you reported the login redirection with 2.5.0, have you noticed the problem with 2.5.0 and after installing 2.5.1 beta 1 it appears again or you just wrote down the wrong app version? Thanks
DaanTry commentedon Jan 26, 2018
PVince81 commentedon Jan 26, 2018
@DaanTry given the data above, I expect that the problem will disappear for you if you switch back to 2.5.0.
DaanTry commentedon Jan 30, 2018
davigonz commentedon Jul 26, 2018
Hi @johnkj , have you noticed this problem again with the recent versions of the Android app, such as 2.8, released a couple of weeks ago?