test size when switching encodings#360
Conversation
|
💥 Acceptance tests pipeline apiMasterKeys-latest-mysql8.0-php7.4 failed. The build has been cancelled. |
|
the test needs to set
with owncloud/core#40240 the miscalculation is fixed |
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
phil-davis
left a comment
There was a problem hiding this comment.
It is good to check the size of encrypted files as seen by the server.
We could have better steps to avoid having to use a When step like:
user "Alice" gets the size of file "/textfile1.txt" using the WebDAV API
in the Then section of the scenarios.
But those steps are already like that in core, so we can live with a bit of "non-standard" scenario step format here.
|
I will merge this when CI finishes, then make an issue for what other test scenario(s) might be useful to have. |
I'm trying to find a code path that triggers the wrong recalculation of the unencrypted filesize.
In my case I have a 19686944 byte encrypted file on disk but a 19447696 byte size in the db. The difference seems to be the overhead for binary encoded chunks.
hm, where did I miscalculate? It feels too close (in the range of less than 8k / one block) to be incidental. My gut tells me there is a codepath that calls
$encryptionModule->getUnencryptedBlockSize($signed)without the encryption module having been initialized first. Theencryption.use_legacy_encodingconfig value may not have been taken into account, causing the default value (false) to return 8096 for the unencrypted block size.... 3 hours later ...
the size difference in the last block is caused by
fixUnencryptedSizeusing the base64 encoding for the end block as it actually initializez the encryption module:So the root cause was indeed a call to fixUnencryptedSize while the encryption module was not already initialized.
This can happen when trying to restore an encrypted file from a backup and running a filescan, setting the encrypted column in the db > 0 and then running the filescan again. Ther may be other codepaths to trigger this.
A might be to always respect
encryption.use_legacy_encodingwhengetUnencryptedBlockSize()is called. BUt I don't know if that causes problems with the default binary encoding ... hm ... something for a test case.Signed-off-by: Jörn Friedrich Dreyer jfd@butonic.de