-
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
Server computes checksum on read/write file operations #26655
Comments
@guruz I'm starting to have the feeling that maybe we shouldn't compute the checksum in the AssemblyStream but instead implement a The advantage of the stream wrapper is that it will cover most code paths, including chunking ng assembly and also download. |
Do you mean stream wrapper or stream filter? |
@guruz I'm only familiar with stream wrappers, but if a stream filter does the same then I'm fine with it. |
I realise this project has not been touched for quite some time. Feel free
to send patches. I'd rather use SHA2 than SHA1, at least for a new
checksum. It shouldn't be much more expensive.
|
@guruz assigning you for now. Let me know if you need guidance or help. |
Posting what I said in the chat: Basically the goal is to try and always have a checksum value available in the matching oc_filecache column. @IljaN you might need to use a similar approach to encryption with a storage wrapper + stream wrapper: @IljaN start debugging encryption here: https://github.com/owncloud/core/blob/master/lib/private/Encryption/Manager.php#L256, then dig into the storage wrapper and see what it does on fopen. Basically a storage wrapper intercepts any FS calls and does things, so it has all regular storage methods. Since a storage wrapper intercepts FS calls, it's likely the best place to add something that needs to act on fopen/file_put_contents. The encryption storage wrapper sets up a stream wrapper (PHP stream wrapper) on fopen. the stream wrapper encrypts In the case of checksum, the stream wrapper would only compute the checksum and store it in oc_filecache in stream_close or so For checksum verification, I think this should happen later. First let the stream wrapper compute the checksum of whatever has been read or written, and add code that runs later (need to find a good place) and compares that checksum with the expected one from the header Let's focus on the computing part first. This is basically the task item "compute and store checksum in database when using fopen in write mode". |
it should actually be possible to copy-paste the encryption storage + stream wrapper code and adjust accordingly encryption also writes some data (unencrypted size) to the filecache. so for checksum replace that code to write the checksum instead so not that much new stuff to invent :-) |
I'd also suggest writing the computed checksum into the stream_context, this way the caller of |
Sorry to jump in to hijack @PVince81 's way of thoughts. I just wanted to re-state that maybe a stream filter would be interesting/easier to do? I'm not a PHP guy and I didn't try it, but it felt better to me than the wrapping orgy we have ;-) https://github.com/bantuXorg/php-stream-filter-hash/blob/master/src/HashFilter.php Maybe it doesn't make sense what I write. |
Could work as replacement for stream wrapper. But storage wrapper still needed to do the application of stream filter in |
…ion, parametrized hash algo owncloud#26655
- do not register checksum wrapper for #26655
…eOldFiles. If testExpireOldFiles runs before testExpireOldFilesShared, the second test fails randomly. #26655
…me weird sideeffects if other tests are running before it, couldn`t find out the root cause, test runs ok in isolation.
Server side checksum verification #26655
Hmm. Comparing to true seems to be wrong in the first place. strpos returns
false or int. Not sure, though.
|
@IljaN ^ |
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. |
Old ticket: #11811
We already have a column "oc_filecache.checksums" in the database.
Tasks
fopen
in write modeOpen questions:
The text was updated successfully, but these errors were encountered: