-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Missing signature with encryption on GDrive #22590
Comments
@PVince81 Can you post the database entry that you have in the filecache for said files? |
|
That's caused by With the wrong header size a ton of dashes are then passed to the decryption method which fails here since dashes are not a valid cipher text. In fact, when doing Let me dig further… |
Using the Guzzle stream directly here will only return 1739 characters for `fread` instead of all data. This leads to the problem that the stream is read incorrectly and thus the data cannot be properly decrypted => 💣 This approach copies the data into a local temporary file, as done before in all stable releases as well as other storage connectors. While this approach will load the whole file into memory, this is already was has happened before in any stable release as well. See d608c37 for the breaking change. To test this enable Google Drive as external storage and upload some files with encryption enabled. Reading the file should fail now. Fixes #22590
Patch is at #22604 |
@LukasReschke is the number of bytes returned by |
I tested with a docker DAV server, and encryption works fine. ( Let me double check whether we use a guzzle download stream there too. |
Yup, see https://github.com/owncloud/core/blob/master/lib/private/files/storage/dav.php#L344 Maybe it is a network buffer thing of some sorts ? |
Works fine on v8.2.2. |
Interesting: I uploaded a file in v8.2.2, encrypted. Bad then we didn't have the signature. |
Ok, the block size is always 1760 big in |
I found where Guzzle does the request, here: https://github.com/owncloud/3rdparty/blob/fc0c1159f4e275186b45f8454aaa89f90718b89e/guzzlehttp/ringphp/src/Client/StreamHandler.php#L406 It's just a plain fopen on the URL... Maybe PHP has trouble with URLs and buffering ? |
Since it's a plain fopen, I can imagine that it's not buffered... Now if Guzzle had a way to buffer this... |
I see |
Indeed, fread might return smaller packets: http://stackoverflow.com/questions/23458069/php-fread-chunk-length-not-taken-into-acount-correctly @schiesbn @LukasReschke @icewind1991 at some point we might want/need to check all fread calls and make them loops. Or use Guzzle's cached wrapper in more places. |
Using the Guzzle stream directly here will only return 1739 characters for `fread` instead of all data. This leads to the problem that the stream is read incorrectly and thus the data cannot be properly decrypted => 💣 This approach copies the data into a local temporary file, as done before in all stable releases as well as other storage connectors. While this approach will load the whole file into memory, this is already was has happened before in any stable release as well. See d608c37 for the breaking change. To test this enable Google Drive as external storage and upload some files with encryption enabled. Reading the file should fail now. Fixes #22590
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. |
Steps
Expected
Download works
Actual
"Missing signature" error.
Note that GDrive's stream is not seekable, in case it's related somehow.
Strangely it works properly on Amazon S3, which isn't seekable either.
Versions
ownCloud 9.0 git master fae6643
@LukasReschke @schiesbn
The text was updated successfully, but these errors were encountered: