Repository navigation
Closed
Description
Steps to reproduce
- Create two users "user1" and "user2"
- Login as "user1"
- Share a file "readonly.txt" with "user2" and remove the "can edit" permission
- Login as "user2" with cadaver
put test.txt readonly.txt- Try uploading a file "readonly.txt" with the web UI and overwrite that file
Expected result
WebDAV: 403 Forbidden
Web UI: Should show an error message
Actual result
WebDAV: 500 Internal Server Error
Web UI: no error message, file refreshes as if it had worked, but still contains old content
Versions
OC 7.0.5, stable8, master
owncloud.log
This is from the WebDAV call:
{"reqId":"550a9c27025ab","app":"webdav","message":"\\OC\\Files\\Filesystem::rename() failed","level":3,"time":"2015-03-19T09:51:35+00:00","method":"PUT","url":"\/owncloud\/remote.php\/webdav\/readonly.txt"}
{"reqId":"550a9c27025ab","app":"webdav","message":"Sabre\\DAV\\Exception: Could not rename part file to final file","level":4,"time":"2015-03-19T09:51:35+00:00","method":"PUT","url":"\/owncloud\/remote.php\/webdav\/readonly.txt"}
{"reqId":"550a9c27025ab","app":"webdav","message":"Exception: #1 [internal function]: Sabre\\DAV\\Server->httpPut('readonly.txt')","level":4,"time":"2015-03-19T09:51:35+00:00","method":"PUT","url":"\/owncloud\/remote.php\/webdav\/readonly.txt"}
{"reqId":"550a9c27025ab","app":"webdav","message":"Exception: #2 \/srv\/www\/htdocs\/owncloud\/3rdparty\/sabre\/dav\/lib\/Sabre\/DAV\/Server.php(474): call_user_func(Array, 'readonly.txt')","level":4,"time":"2015-03-19T09:51:35+00:00","method":"PUT","url":"\/owncloud\/remote.php\/webdav\/readonly.txt"}
{"reqId":"550a9c27025ab","app":"webdav","message":"Exception: #3 \/srv\/www\/htdocs\/owncloud\/3rdparty\/sabre\/dav\/lib\/Sabre\/DAV\/Server.php(214): Sabre\\DAV\\Server->invokeMethod('PUT', 'readonly.txt')","level":4,"time":"2015-03-19T09:51:35+00:00","method":"PUT","url":"\/owncloud\/remote.php\/webdav\/readonly.txt"}
{"reqId":"550a9c27025ab","app":"webdav","message":"Exception: #4 \/srv\/www\/htdocs\/owncloud\/apps\/files\/appinfo\/remote.php(60): Sabre\\DAV\\Server->exec()","level":4,"time":"2015-03-19T09:51:35+00:00","method":"PUT","url":"\/owncloud\/remote.php\/webdav\/readonly.txt"}
{"reqId":"550a9c27025ab","app":"webdav","message":"Exception: #5 \/srv\/www\/htdocs\/owncloud\/remote.php(52): require_once('\/srv\/www\/htdocs...')","level":4,"time":"2015-03-19T09:51:35+00:00","method":"PUT","url":"\/owncloud\/remote.php\/webdav\/readonly.txt"}
{"reqId":"550a9c27025ab","app":"webdav","message":"Exception: #6 {main}","level":4,"time":"2015-03-19T09:51:35+00:00","method":"PUT","url":"\/owncloud\/remote.php\/webdav\/readonly.txt"}
The web UI call doesn't produce any log entries.
Maybe a permission check is missing somewhere.
Note that this is only for file shares (files shared directly, not through a read-only shared folder)
The issue isn't that bad, but note that a 500 instead of 403 could mess up with the sync client and/or get the file blacklisted from sync.
Activity
PVince81 commentedon Mar 20, 2015
It looks like the permissions aren't read properly. Even though the share permission of "readonly.txt" is 17, we got 27 which contains the "updatable" flag. So it bypasses the permission check on upload.
PVince81 commentedon Mar 20, 2015
I debugged through the code and saw that the share permissions 17 were retrieved properly. Then some part of code added the delete permission (unshare from self), so it became 25.
And then it reached that line: https://github.com/owncloud/core/blob/master/lib/private/files/view.php#L1136 that would automatically add delete+update permissions...
PVince81 commentedon Mar 20, 2015
Fix is here: #15063