205 Commits

Author SHA1 Message Date
Côme Chilliet
cc397d5ca4 fix(encryption): Fix user key support with basic auth
When using basic authentication the user is not logged in yet when
 KeyManager constructor gets called, so we need to delay the check for
 the loggedin user uid.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-11-13 10:52:44 +00:00
Ferdinand Thiessen
44955d93ba fix(encryption): do not setup filesystem without permissions
If the current request does not have permissions for the filesystem we
must not try to setup the filesystem.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2025-09-22 09:44:25 +00:00
Côme Chilliet
51f8379140 chore(encryption): Remove unused attribute $uid in KeyManager::getFileKey
It’s a private API in the application, no need to keep an unused
 attribute.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-09-11 21:18:37 +02:00
Côme Chilliet
e66e2fb6e1 fix(tests): Fix type issues and other problems with encryption tests
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-09-11 21:18:37 +02:00
Côme Chilliet
a889e29e6d chore(tests): Adapt encryption tests to code changes
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-09-11 21:18:37 +02:00
Côme Chilliet
f95fef9938 chore(encryption): Adapt tests to code changes
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-08-04 11:53:19 +02:00
Côme Chilliet
58e8626f5f chore: Adapt tests to new parameter in EncryptAll constructor
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-07-03 15:19:34 +02:00
Robin Appelman
aa15f9d16d chore: run rector
Signed-off-by: Robin Appelman <robin@icewind.nl>
2025-07-01 22:45:52 +02:00
Ferdinand Thiessen
d0758fe6ac test(encryption): adjust test code for PHPUnit 10 deprecations
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2025-05-28 11:20:15 +02:00
Côme Chilliet
64863c9d46 chore: Apply new rector configuration to apps folder
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2025-02-13 11:46:42 +01:00
provokateurin
381077028a refactor(apps): Use constructor property promotion when possible
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-10-21 12:37:59 +02:00
Ferdinand Thiessen
f3aa004b1c refactor(encryption): Migrate away from Hooks to typed events
Co-authored-by: Ferdinand Thiessen <opensource@fthiessen.de>
Co-authored-by: Louis <louis@chmn.me>
Co-authored-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2024-10-15 18:33:06 +02:00
Côme Chilliet
1580c8612b chore(apps): Apply new rector configuration to autouse classes
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-10-15 10:40:25 +02:00
Joas Schilling
4312473fbc test: Fix wrongly mocked method
Signed-off-by: Joas Schilling <coding@schilljs.com>
2024-10-07 12:11:35 +02:00
Côme Chilliet
1a4978c4ea chore: Apply rector configuration to apps folder
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-09-20 17:51:00 +02:00
provokateurin
9836e9b164 chore(deps): Update nextcloud/coding-standard to v1.3.1
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-09-19 14:21:20 +02:00
Côme Chilliet
801733e523 fix: Remove OCP\Files\Storage interface deprecated since version 9
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-09-16 18:10:48 +02:00
Christoph Wurst
49dd79eabb refactor: Add void return type to PHPUnit test methods
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2024-09-15 22:32:31 +02:00
Daniel Kesselberg
af6de04e9e style: update codestyle for coding-standard 1.2.3
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2024-08-25 19:34:58 +02:00
Louis Chemineau
f244261e85 test: Fix encryption test
Signed-off-by: Louis Chemineau <louis@chmn.me>
2024-06-06 18:02:32 +02:00
Andy Scherzinger
5b7dcc1427 chore: Add SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
2024-05-29 08:58:16 +02:00
Joas Schilling
6dffc9bc17 fix(CS): Fix coding style
Signed-off-by: Joas Schilling <coding@schilljs.com>
2024-01-26 16:05:09 +01:00
Ferdinand Thiessen
c3d63c57ce fix(encryption): Fix deprecated syntax in encryption tests
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2024-01-26 14:53:33 +01:00
Joas Schilling
aa5f037af7 chore: apply changes from Nextcloud coding standards 1.1.1
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
2023-11-23 10:36:13 +01:00
Côme Chilliet
1e06b61f59 Migrate away from ILogger in encryption
And modernize code a bit

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-08-08 09:14:16 +02:00
Côme Chilliet
99bdb15398 Adapt encryption test to change in generateHeader
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-05-25 16:31:27 +02:00
Ferdinand Thiessen
dc9d8c42bb fix: Adjust console formatter code to match with Symfony type hints
Symfony has added type hints on the `OutputFormatterInterface`,
so we must adjust our type hints to match with Symfony.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
2023-04-17 18:35:10 +02:00
Joas Schilling
0b88b513be Merge pull request #36351 from nextcloud/bugfix/noid/move-encryption-password-email-to-template
Move encrypt-all password email to EmailTemplate
2023-04-14 14:48:47 +02:00
Côme Chilliet
8f550398c4 Merge pull request #36836 from nextcloud/fix/view-type-cleanup
Tidy up typing in OC\Files\View
2023-04-05 10:14:55 +02:00
Côme Chilliet
7fdb23928f Merge pull request #37243 from nextcloud/enh/openssl-get-rid-of-rc4
Getting rid of openssl_seal and rc4 in server side encryption
2023-04-04 10:38:02 +02:00
Côme Chilliet
4393b96542 Remove unused method getLocalFolder
It’s not used and not in any OCP interface/class.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-04-03 10:52:34 +02:00
Robin Appelman
808a80eb9c add test for unmarking encrypted file on cross storage move
Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-04-01 15:36:38 +00:00
Côme Chilliet
430009b8e2 Add a test for multiKeyEncrypt/Decrypt methods
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-03-20 14:19:13 +01:00
Côme Chilliet
0750481bb7 Adapt encryption recovery tests to new system
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-03-17 11:08:59 +01:00
Côme Chilliet
26d8fb0b65 Adapt encryption tests to the new system
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-03-17 11:08:59 +01:00
Côme Chilliet
8900d030d1 Adapt code to new encryption system
fileKey gets deleted upon save as it’s stored in shareKeys instead now.
We use presence of a fileKey to detect if a file is using the legacy
 system or the new one, because we do not always have access to header
 data.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-03-17 11:08:58 +01:00
Joas Schilling
f60e1f751d Fix unit tests
Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-03-08 20:47:46 +01:00
Vincent Petry
4f2923862a Merge pull request #35108 from nextcloud/encryption-fix-versions-all
allow running encryption:fix-encrypted-version for all users
2022-12-16 17:20:40 +01:00
J0WI
71e490090f Replace getSystemValue in encryption app
Signed-off-by: J0WI <J0WI@users.noreply.github.com>
2022-12-05 14:30:58 +01:00
Robin Appelman
2399710356 allow running encryption:fix-encrypted-version for all users
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-11-29 17:49:35 +01:00
Côme Chilliet
73702e6350 Adapt test to fixed command output.
No user and non-existing user are now correctly treated as two separated
 cases

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-08-04 10:06:36 +02:00
Côme Chilliet
deac17b71e Remove at() matcher use from encryption tests
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-05-24 12:18:19 +02:00
plumbeo
1258caeab7 Save encrypted files in binary format
Default to the more space-efficient binary encoding for newly encrypted files
instead of the traditional base64 encoding, eliminating the 33% overhead.

The new option 'encryption.use_legacy_encoding' allows to force the legacy
encoding format if needed. Files encoded in the old format remain readable.

Based on https://github.com/owncloud/encryption/pull/224 and
https://github.com/owncloud/core/pull/38249 by karakayasemi.

Signed-off-by: plumbeo <plumbeo@users.noreply.github.com>
2022-05-04 17:38:25 +02:00
Côme Chilliet
37f8f7a5a1 Fix tests on PHP 8.1 for encryption, files_sharing, files_version,
files_trashbin and theming apps

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-16 09:43:29 +01:00
Vincent Petry
60e44077b7 Fix encrypted version to 0 when finding unencrypted file
Whenever the command is run and a "legacy cipher" seems to be detected
when the legacy option is disabled, it's highly likely that the file is
actually unencrypted but the database contains a encrypted version
higher than 0 for some reason.

The command now detects this case and automatically sets the encrypted
version to 0 so that the file can be read again.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-08-26 10:44:49 +02:00
Vincent Petry
d3eeecba54 Prevent running FixEncryptedVersion without master key
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>
2021-06-29 20:44:07 +02:00
Vincent Petry
101c65a949 Fix FixEncryptedVersionTest test
Fixed setup to use EncryptionTrait like other existing tests.
Fix expectations to not rely on side effects from previous test cases.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-06-29 14:39:51 +02:00
Vincent Petry
43a0016aa7 Downstream FixEncryptedVersionTest
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-06-29 14:39:51 +02:00
John Molakvoæ (skjnldsv)
215aef3cbd Update php licenses
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-06-04 22:02:41 +02:00
Morris Jobke
dc981623aa Fix test
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2021-05-20 09:44:56 +02:00