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

No OC-Checksum header when downloading file #1316

Closed
individual-it opened this issue Feb 24, 2020 · 3 comments
Closed

No OC-Checksum header when downloading file #1316

individual-it opened this issue Feb 24, 2020 · 3 comments

Comments

@individual-it
Copy link
Member

ocis-reva:

GET /remote.php/webdav/myChecksumFile.txt HTTP/1.1
Host: localhost:9140
User-Agent: GuzzleHttp/6.5.1 curl/7.58.0 PHP/7.1.33-4+ubuntu18.04.1+deb.sury.org+1
Authorization: Basic dXNlcjA6MTIzNDU2

HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Type: text/plain; charset=utf-8
Etag: "be42d3684d1ea2055c063088cfe9ce5a"
Last-Modified: Mon, 24 Feb 2020 13:10:02 +0545
Oc-Etag: "be42d3684d1ea2055c063088cfe9ce5a"
Oc-Fileid: MTIzZTQ1NjctZTg5Yi0xMmQzLWE0NTYtNDI2NjU1NDQwMDAwOmYxMDZlZmM4LTM1NzUtNDJjOS05YWYzLTQxMDcxNjRiYThhNw==
Vary: Origin
X-Access-Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJyZXZhIiwiZXhwIjoxNTgyNTMyNzAyLCJpYXQiOjE1ODI1MjkxMDIsInVzZXIiOnsiaWQiOnsib3BhcXVlX2lkIjoidXNlcjAifSwidXNlcm5hbWUiOiJ1c2VyMCIsIm1haWwiOiJ1c2VyMEBleGFtcGxlLm9yZyIsImRpc3BsYXlfbmFtZSI6IlVzZXIgWmVybyJ9fQ.WCJdAq8ZwVMk534nips5Iskgzj8wytsECRMJFPFvc4g
Date: Mon, 24 Feb 2020 07:25:02 GMT
Content-Length: 28

This is a testfile.

Cheers.

vs. oC 10

GET /owncloud-core/remote.php/webdav/myChecksumFile.txt HTTP/1.1
Host: localhost
User-Agent: GuzzleHttp/6.5.1 curl/7.58.0 PHP/7.1.33-4+ubuntu18.04.1+deb.sury.org+1
Authorization: Basic dXNlcjA6MTIzNDU2

HTTP/1.1 200 OK
Date: Mon, 24 Feb 2020 07:26:53 GMT
Server: Apache/2.4.41 (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: oc4kyqahfanl=23no409ihcdmg715vh32cqqo55; path=/owncloud-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=0W5ekCibiPvCbi%2BLp9lzoAU%2Bi%2BUySQwY%2FtW%2Bha84Txn7sm5WUBLKaftozZd1%2BtvuZAtoYcVuzuUYKQ%2Fv4a0eQsXEEetkWvICczMzBXz1ck4bbJcbsmZ9SE0a4lAHf%2Bbg; path=/owncloud-core; HttpOnly
Content-Security-Policy: default-src 'none';
Set-Cookie: oc4kyqahfanl=18pm780lbmgck3lhvubol3hu6k; path=/owncloud-core; HttpOnly
Set-Cookie: cookie_test=test; expires=Mon, 24-Feb-2020 08:26:53 GMT; Max-Age=3600
Last-Modified: Mon, 24 Feb 2020 07:26:53 GMT
ETag: "f5d2d087632b4f252691205c8e9e2018"
Content-Length: 28
OC-ETag: "f5d2d087632b4f252691205c8e9e2018"
Content-Disposition: attachment; filename*=UTF-8''myChecksumFile.txt; filename="myChecksumFile.txt"
OC-Checksum: SHA1:3ee962b839762adb0ad8ba6023a4690be478de6f
X-Accel-Buffering: no
Content-Type: text/plain;charset=UTF-8

This is a testfile.

Cheers.
@C0rby C0rby self-assigned this Feb 28, 2020
@C0rby
Copy link
Contributor

C0rby commented Feb 28, 2020

@butonic, so I have implemented a simple version of generating checksums but do we still want to use SHA-1 since it is considered broken for a long time now.

@PVince81
Copy link
Contributor

PVince81 commented May 5, 2020

make test-acceptance-api \
TEST_SERVER_URL=http://localhost:9140 \
TEST_EXTERNAL_USER_BACKENDS=true \
TEST_OCIS=true \
OCIS_REVA_DATA_ROOT=/var/tmp/reva/ \
BEHAT_FILTER_TAGS='~@skipOnOcV10&&~@skipOnLDAP&&@TestAlsoOnExternalUserBackend&&~@local_storage&&@issue-ocis-reva-98'
composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Package container-interop/container-interop is abandoned, you should avoid using it. Use psr/container instead.
Package guzzlehttp/ringphp is abandoned, you should avoid using it. No replacement was suggested.
Package guzzlehttp/streams is abandoned, you should avoid using it. No replacement was suggested.
Package jakub-onderka/php-console-color is abandoned, you should avoid using it. Use php-parallel-lint/php-console-color instead.
Package jakub-onderka/php-console-highlighter is abandoned, you should avoid using it. Use php-parallel-lint/php-console-highlighter instead.                                                                                                                                 
Generating optimized autoload files
Composer cleaner: Removed 5 files or directories.
composer bin behat install --no-progress
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Package container-interop/container-interop is abandoned, you should avoid using it. Use psr/container instead.
Package zendframework/zend-ldap is abandoned, you should avoid using it. Use laminas/laminas-ldap instead.
Generating autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
./tests/acceptance/run.sh --type api
Script path: /srv/www/htdocs/owncloud/tests/acceptance
Not using php inbuilt server for running scenario ...
Updating .htaccess for proper rewrites
PHP Warning:  fopen(/srv/www/htdocs/owncloud/config/config.php): failed to open stream: Permission denied in /srv/www/htdocs/owncloud/lib/private/Config.php on line 239
PHP Warning:  flock() expects parameter 1 to be resource, bool given in /srv/www/htdocs/owncloud/lib/private/Config.php on line 249


Running all API tests tagged ~@skipOnOcV&&~@skipOnOcV&&~@skipOnOcV&&~@skipOnOcV10&&~@skipOnLDAP&&@TestAlsoOnExternalUserBackend&&~@local_storage&&@issue-ocis-reva-98&&@api&&~@skip 
@api @TestAlsoOnExternalUserBackend
Feature: checksums

  Background:                                                                      # /srv/www/htdocs/owncloud/tests/acceptance/features/apiMain/checksums.feature:4                                                                                                           
    Given user "user0" has been created with default attributes and skeleton files # FeatureContext::userHasBeenCreatedWithDefaultAttributes()                                                                                                                                

  @smokeTest @skipOnOcis @issue-ocis-reva-98
  Scenario Outline: Uploading a file with checksum should return the checksum in the download header                                               # /srv/www/htdocs/owncloud/tests/acceptance/features/apiMain/checksums.feature:28
    Given using <dav_version> DAV path                                                                                                             # FeatureContext::usingOldOrNewDavPath()
    And user "user0" has uploaded file "filesForUpload/textfile.txt" to "/myChecksumFile.txt" with checksum "MD5:d70b40f177b14b470d1756a3c12b963a" # ChecksumContext::userHasUploadedFileToWithChecksumUsingTheAPI()
    When user "user0" downloads file "/myChecksumFile.txt" using the WebDAV API                                                                    # FeatureContext::userDownloadsFileUsingTheAPI()
    Then the header checksum should match "SHA1:3ee962b839762adb0ad8ba6023a4690be478de6f"                                                          # ChecksumContext::theHeaderChecksumShouldMatch()

    Examples:
      | dav_version |
      | old         |
        Notice: Undefined offset: 0 in /srv/www/htdocs/owncloud/tests/acceptance/features/bootstrap/ChecksumContext.php line 217
      | new         |
        Notice: Undefined offset: 0 in /srv/www/htdocs/owncloud/tests/acceptance/features/bootstrap/ChecksumContext.php line 217

  @skipOnOcis @issue-ocis-reva-98 @issue-ocis-reva-21
  Scenario: Downloading a file with checksum should return the checksum in the download header                                                     # /srv/www/htdocs/owncloud/tests/acceptance/features/apiMain/checksums.feature:64
    Given using old DAV path                                                                                                                       # FeatureContext::usingOldOrNewDavPath()
    And user "user0" has uploaded file "filesForUpload/textfile.txt" to "/myChecksumFile.txt" with checksum "MD5:d70b40f177b14b470d1756a3c12b963a" # ChecksumContext::userHasUploadedFileToWithChecksumUsingTheAPI()
    When user "user0" moves file "/myChecksumFile.txt" to "/myMovedChecksumFile.txt" using the WebDAV API                                          # FeatureContext::userMovesFileUsingTheAPI()
    And user "user0" downloads file "/myMovedChecksumFile.txt" using the WebDAV API                                                                # FeatureContext::userDownloadsFileUsingTheAPI()
    Then the header checksum should match "SHA1:3ee962b839762adb0ad8ba6023a4690be478de6f"                                                          # ChecksumContext::theHeaderChecksumShouldMatch()
      Notice: Undefined offset: 0 in /srv/www/htdocs/owncloud/tests/acceptance/features/bootstrap/ChecksumContext.php line 217

  @skipOnOcis @issue-ocis-reva-98
  Scenario: Copying file with checksum should return the checksum in the download header using new DAV path                                        # /srv/www/htdocs/owncloud/tests/acceptance/features/apiMain/checksums.feature:124
    Given using new DAV path                                                                                                                       # FeatureContext::usingOldOrNewDavPath()
    And user "user0" has uploaded file "filesForUpload/textfile.txt" to "/myChecksumFile.txt" with checksum "MD5:d70b40f177b14b470d1756a3c12b963a" # ChecksumContext::userHasUploadedFileToWithChecksumUsingTheAPI()
    When user "user0" copies file "/myChecksumFile.txt" to "/myChecksumFileCopy.txt" using the WebDAV API                                          # FeatureContext::userCopiesFileUsingTheAPI()
    And user "user0" downloads file "/myChecksumFileCopy.txt" using the WebDAV API                                                                 # FeatureContext::userDownloadsFileUsingTheAPI()
    Then the header checksum should match "SHA1:3ee962b839762adb0ad8ba6023a4690be478de6f"                                                          # ChecksumContext::theHeaderChecksumShouldMatch()
      Notice: Undefined offset: 0 in /srv/www/htdocs/owncloud/tests/acceptance/features/bootstrap/ChecksumContext.php line 217

--- Failed scenarios:

    /srv/www/htdocs/owncloud/tests/acceptance/features/apiMain/checksums.feature:35
    /srv/www/htdocs/owncloud/tests/acceptance/features/apiMain/checksums.feature:36
    /srv/www/htdocs/owncloud/tests/acceptance/features/apiMain/checksums.feature:64
    /srv/www/htdocs/owncloud/tests/acceptance/features/apiMain/checksums.feature:124

@C0rby C0rby removed their assignment Jun 10, 2020
@butonic butonic transferred this issue from owncloud/ocis-reva Jan 18, 2021
@refs refs changed the title no OC-Checksum header when downloading file No OC-Checksum header when downloading file Jan 19, 2021
@refs
Copy link
Member

refs commented Jan 19, 2021

closing in favor of #1316

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

No branches or pull requests

4 participants