Repository navigation
Description
Session cookie is not being expired when OAuth access token expires, allowing us to perform successful operations when they should be unauthorized.
I have tried to reproduce the opposite case, revoking a session and seeing if the access token is also expired, but after installing OAuth2 in a 10 server and going to Settings/Security options, where all the sessions should appear, I get an Internal Server Error. See owncloud/oauth2#51
Steps to reproduce
- Complete OAuth2 login flow.
- Expires access token manually from the server database. Restart the server just in case.
- Try to do a request, for example, listing a directory:
Curl command to list a directory:
curl -X PROPFIND -H "Content-Type: text/xml" -H "User-Agent: Mozilla/5.0 (Android) ownCloud-android/2.4.0" -H "Authorization: Bearer accessToken" -d "<?xml version='1.0' encoding='utf-8' ?><D:propfind xmlns:D='DAV:'><D:allprop/></D:propfind>" url:port/remote.php/webdav -H "Cookie: oc_sessionPassphrase=whatEver" | xmllint --format -
Expected behaviour
Server should response with an error related to not authentication or bearer token incorrect.
Expected curl result:
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
<s:exception>Sabre\DAV\Exception\NotAuthenticated</s:exception>
<s:message>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, Bearer token was incorrect</s:message>
</d:error>Actual behaviour
Server response is successful, includes a multiresponse with info about the directory.
Actual curl result:
<?xml version="1.0"?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns">
<d:response>
<d:href>/remote.php/webdav/</d:href>
<d:propstat>
<d:prop>
<d:getlastmodified>Thu, 06 Jul 2017 10:40:57 GMT</d:getlastmodified>
<d:resourcetype>
<d:collection/>
</d:resourcetype>
<d:quota-used-bytes>6767385</d:quota-used-bytes>
<d:quota-available-bytes>-3</d:quota-available-bytes>
<d:getetag>"595e13b90e40a"</d:getetag>
</d:prop>
<d:status>HTTP/1.1 200 OK</d:status>
</d:propstat>
</d:response>
<d:response>
<d:href>/remote.php/webdav/Documents/</d:href>
<d:propstat>
<d:prop>
<d:getlastmodified>Thu, 06 Jul 2017 10:39:52 GMT</d:getlastmodified>
<d:resourcetype>
<d:collection/>
</d:resourcetype>
<d:quota-used-bytes>45207</d:quota-used-bytes>
<d:quota-available-bytes>-3</d:quota-available-bytes>
<d:getetag>"595e1378d2612"</d:getetag>
</d:prop>
<d:status>HTTP/1.1 200 OK</d:status>
</d:propstat>
</d:response>
<d:response>
<d:href>/remote.php/webdav/Photos/</d:href>
<d:propstat>
<d:prop>
<d:getlastmodified>Thu, 06 Jul 2017 07:57:45 GMT</d:getlastmodified>
<d:resourcetype>
<d:collection/>
</d:resourcetype>
<d:quota-used-bytes>678556</d:quota-used-bytes>
<d:quota-available-bytes>-3</d:quota-available-bytes>
<d:getetag>"595ded79c3800"</d:getetag>
</d:prop>
<d:status>HTTP/1.1 200 OK</d:status>
</d:propstat>
</d:response>
</d:multistatus>Server configuration
Web server: Apache 2.4.18
Database: MySQL
PHP version: php7.0.18
ownCloud version: 10.0.2 (stable)
Activity
DeepDiver1975 commentedon Jul 7, 2017
@davigonz please test owncloud/oauth2#53
davigonz commentedon Jul 7, 2017
Yeah, I'm getting an unauthorized HTTP response as expected.
👍
lock commentedon Aug 1, 2019
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.