-
-
Notifications
You must be signed in to change notification settings - Fork 4.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
Downstream encryption:fix-encrypted-version for repairing "bad signature" errors #27638
Conversation
Groupfolders currently don't support encryption nextcloud/groupfolders@4521451 |
Thoughts ? |
7b68984
to
68b8ff5
Compare
rebased as I forgot to pull before I made this branch |
68b8ff5
to
2f190c7
Compare
I've now also downstreamed the matching unit tests file. |
for #27638 (comment) I went with approach 1: display an error if the skip flag is set. That should do for now. |
2f190c7
to
a9215f5
Compare
I'm trying to fix the unit tests, there seem to be a discrepancy of behavior, but could be due to test setup |
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
5921efb
Compare
yeah, I suspected that:
the test setup is dirty and causing side effects
|
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 😢 |
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>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and works and code looks good.
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. |
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. |
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. |
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>
@juliushaertl I've added an extra check d3eeecb please re-review |
failing test unrelated |
/backport to stable22 |
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. |
I'd vote for that 👍 Any concers @skjnldsv ? |
force-merge needed due to intermitted acceptance test failure |
/backport to stable21 |
/backport to stable20 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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-version
User-key encryption
recovering all files for usernot supportedrecovering by path for usernot supportedMaster-key encryption
Other