Uh oh!
There was an error while loading. Please reload this page.
Downstream encryption:fix-encrypted-version for repairing "bad signature" errors - #27638
Conversation
juliusknorr
commented
Jun 23, 2021
Groupfolders currently don't support encryption nextcloud/groupfolders@4521451 |
Thoughts ? |
7b68984 to
68b8ff5ComparePVince81
commented
Jun 23, 2021
rebased as I forgot to pull before I made this branch |
68b8ff5 to
2f190c7ComparePVince81
commented
Jun 24, 2021
I've now also downstreamed the matching unit tests file. |
PVince81
commented
Jun 24, 2021
for #27638 (comment) I went with approach 1: display an error if the skip flag is set. That should do for now. |
2f190c7 to
a9215f5ComparePVince81
commented
Jun 24, 2021
I'm trying to fix the unit tests, there seem to be a discrepancy of behavior, but could be due to test setup |
PVince81
commented
Jun 24, 2021
okay, I'm guessing that NC doesn't encrypt / doesn't increase the encryption version when a file is empty, so the test calls to |
d8bb916 to
5921efbCompareyeah, I suspected that: the test setup is dirty and causing side effects
|
PVince81
commented
Jun 29, 2021
the tests of the app run fine for me locally, so I suspect that there might be another test that runs before that doesn't clean up properly and is causing side effects. good luck finding which one 😢 |
PVince81
commented
Jun 29, 2021
I've done some manual bisecting by deleting tests and running the whole DB suite locally: when deleting "apps/dav/tests" the encryption tests pass. So that folder likely contains a test that is causing side effects. |
getting closer, it's in the "apps/dav/tests/unit/Connector/Sabre/RequestTest" folder. If I delete that folder the encryption test will pass.
yup, it's EncryptionMasterKeyUploadTest.php |
For fixing "Bad signature" errors. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
When running occ encryption:fix-encrypted-version, detect whether the setting 'encryption_skip_signature_check' is set and abort if it is, because the repair cannot detect version mismatch errors with it enabled. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
juliusknorr
left a comment
There was a problem hiding this comment.
Tested and works and code looks good.
juliusknorr
commented
Jun 29, 2021
Since the user key todos are still in the description, I'd say user key handling is out of scope for now since we'd need to provide the password of the user somehow. If we might need a recover option for that, we could probably maybe wrap the fixing logic into a small app to allow users to trigger it within their session as a kind of self service. |
PVince81
commented
Jun 29, 2021
Indeed. IIRC user key decryption is not supported by the command anyway as it would require either the user's password or a recovery key to be configured for that user. |
juliusknorr
commented
Jun 29, 2021
I didn't see any check in that regard so i guess it would still try to find the matching encryptedVersion which would just not be successful then, but also haven't tested that. |
PVince81
commented
Jun 29, 2021
if this is a concern, it should be possible to add a check for master key for this command and abort in case none is found all this is assuming that the "default encryption module" is being used |
Return an error when running occ encryption:fix-encrypted-version when master key encryption is not enabled. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
PVince81
commented
Jun 29, 2021
@juliushaertl I've added an extra check d3eeecb please re-review |
PVince81
commented
Jun 30, 2021
failing test unrelated |
PVince81
commented
Jun 30, 2021
/backport to stable22 |
PVince81
commented
Jun 30, 2021
While this is an addition / feature, I wonder if we should backport this further down as it will be useful for fixing broken setups and would be safer than letting people patch their instances there. |
juliusknorr
commented
Jun 30, 2021
I'd vote for that 👍 Any concers @skjnldsv ? |
PVince81
commented
Jun 30, 2021
force-merge needed due to intermitted acceptance test failure |
skjnldsv
commented
Jun 30, 2021
/backport to stable21 |
skjnldsv
commented
Jun 30, 2021
/backport to stable20 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
PVince81
commented
Jun 30, 2021
PR for the docs here: nextcloud/documentation#6884 |
For fixing "Bad signature" errors.
Imported from https://github.com/owncloud/encryption/blob/c8d67f5/lib/Command/FixEncryptedVersion.php (master from that time).
No changes were made in the initial import.
Tests
To test, upload a file and then manually change its "encrypted" value to either value - 1 or value + 1 then run
occ encryption:fix-encrypted-versionUser-key encryption
recovering all files for usernot supportedrecovering by path for usernot supportedMaster-key encryption
Other