Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Existing file gets deleted when you attemp to overwrite the file while providing invalid checksum #224

Open
dpakach opened this issue Jun 21, 2019 · 2 comments
Labels

Comments

@dpakach
Copy link
Contributor

dpakach commented Jun 21, 2019

Steps to reproduce

  • Setup ceph storage.
  • Upload a file.
  • Try to upload another file with same name but give an invalid checksum.

Expected Result

  • The files doesnot gets overwritten and the original files remains as it was.

Actual Behavior

@dpakach
Copy link
Contributor Author

dpakach commented Jun 21, 2019

Steps followed to reproduce

  • Start the docker docker run -e NETWORK_AUTO_DETECT=4 -e CEPH_DEMO_UID=owncloud -e CEPH_DEMO_ACCESS_KEY=owncloud123456 -e CEPH_DEMO_SECRET_KEY=secret123456 owncloudci/ceph:tag-build-master-jewel-ubuntu-16.04

  • copy apps/files_primary_s3//tests/drone/ceph.config.php to config/

  • With docker ps -a find the id of the container

  • Using docker inspect <id> find the IPAddress of the container

  • Edit config/ceph.config.php : modify 'endpoint' => 'http://ceph:80/' with 'endpoint' => 'http://<IP>:80/'

  • create the bucket ./occ s3:create-bucket OWNCLOUD --accept-warning

  • Upload a file file.txt from the webUI.

  • Upload same file with curl.

➜ curl -u admin:admin -X PUT 'http://localhost/core/remote.php/dav/files/admin/file.txt' -d "BBBBB" -H "OC-Checksum: SHA1:random"  -v
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 80 (#0)
* Server auth using Basic with user 'admin'
> PUT /core/remote.php/dav/files/admin/behat.yml HTTP/1.1
> Host: localhost
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.58.0
> Accept: */*
> OC-Checksum: SHA1:random
> Content-Length: 5
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 5 out of 5 bytes
< HTTP/1.1 400 Bad Request
< Date: Fri, 21 Jun 2019 06:50:27 GMT
< Server: Apache/2.4.29 (Ubuntu)
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< X-Robots-Tag: none
< X-Frame-Options: SAMEORIGIN
< X-Download-Options: noopen
< X-Permitted-Cross-Domain-Policies: none
< Set-Cookie: ocoh4qn2fdqf=g1ug8o8gok26683jl8365h2642; path=/core; HttpOnly
< Expires: Thu, 19 Nov 1981 08:52:00 GMT
< Cache-Control: no-store, no-cache, must-revalidate
< Pragma: no-cache
< Set-Cookie: oc_sessionPassphrase=DRxNN4VzI76g%2BzIWi46YMveCHjeG88TkbpNfvnDf0Uo5ll5F3u7yx1GLBvunME9YZqBAY5ARuEcSVpD9SbwCzC601dXEziMCqo7sko%2FvaKkFLuDMAaT%2Bao%2FyUC5urRlO; path=/core; HttpOnly
< Content-Security-Policy: default-src 'none';
< Set-Cookie: ocoh4qn2fdqf=gfr1nkragg1v9lino69ubc9jnu; path=/core; HttpOnly
< Set-Cookie: cookie_test=test; expires=Fri, 21-Jun-2019 07:50:27 GMT; Max-Age=3600
< Content-Length: 264
< Connection: close
< Content-Type: application/xml; charset=utf-8
< 
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:exception>Sabre\DAV\Exception\BadRequest</s:exception>
  <s:message>The computed checksum does not match the one received from the client.</s:message>
</d:error>
* Closing connection 0

result

  • The original file gets deleted.

@dpakach
Copy link
Contributor Author

dpakach commented Jun 21, 2019

TODO:

  • unskip tests tagged @skipOnStorage:ceph @files_primary_s3-issue-224
tests/acceptance/features/apiMain/checksums.feature:280
tests/acceptance/features/apiMain/checksums.feature:300

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant