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

Properly handle encrypted/plain file size with object storage #22994

Closed
juliusknorr opened this issue Sep 21, 2020 · 3 comments
Closed

Properly handle encrypted/plain file size with object storage #22994

juliusknorr opened this issue Sep 21, 2020 · 3 comments
Labels

Comments

@juliusknorr
Copy link
Member

juliusknorr commented Sep 21, 2020

When using primary object storage we store the size of the bytes written to the storage in the file cache. Since the filecache is reused for the stat call, fetching the file size will lead to the encrypted size being returned in https://github.com/nextcloud/server/blob/master/lib/private/Files/Storage/Wrapper/Encryption.php#L494 instead of the unencrypted one as it would be the case for local storage. Now the filecache has a column unencrypted_size which seems to be never used actually. This will actually cause https://github.com/nextcloud/server/blob/master/lib/private/Files/Storage/Wrapper/Encryption.php#L526 to be called with both size and unencryptedSize being the same, the encrypted size.

While we could go though the whole file to check the signature on the last block this has quite some performance impact, so we'd need a way to either make sure that the unencrypted size is put into the size column (as it is currently done for local storage) or better use the unencrypted_size in general to store this.

Steps to reproduce:

  • primary object storage
  • upload a file
  • download it
  • download it again to encounter a bad signature exception

cc @rullzer

@juliusknorr juliusknorr added bug 1. to develop Accepted and waiting to be taken care of labels Sep 21, 2020
@juliusknorr juliusknorr self-assigned this Sep 21, 2020
@juliusknorr juliusknorr changed the title Properly store encrypted/plain file size with object storage Properly handle encrypted/plain file size with object storage Sep 21, 2020
@J0WI
Copy link
Contributor

J0WI commented Jul 6, 2021

Related to #10767 #16906 #22077 #17561
Not sure if owncloud/core#26917 would help here?

@juliusknorr juliusknorr removed their assignment Aug 12, 2021
@szaimen
Copy link
Contributor

szaimen commented Jan 23, 2023

Hi, please update to 24.0.9 or better 25.0.3 and report back if it fixes the issue. Thank you!

My goal is to add a label like e.g. 25-feedback to this ticket of an up-to-date major Nextcloud version where the bug could be reproduced. However this is not going to work without your help. So thanks for all your effort!

If you don't manage to reproduce the issue in time and the issue gets closed but you can reproduce the issue afterwards, feel free to create a new bug report with up-to-date information by following this link: https://github.com/nextcloud/server/issues/new?assignees=&labels=bug%2C0.+Needs+triage&template=BUG_REPORT.yml&title=%5BBug%5D%3A+

@szaimen szaimen added needs info 0. Needs triage Pending check for reproducibility or if it fits our roadmap and removed 1. to develop Accepted and waiting to be taken care of labels Jan 23, 2023
@juliusknorr
Copy link
Member Author

Fixed by @icewind1991 recently.

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

3 participants