Commit Graph

58 Commits

Author SHA1 Message Date
provokateurin
f12cecb684 feat(rector): Enable SafeDeclareStrictTypesRector
Signed-off-by: provokateurin <kate@provokateurin.de>
2026-02-09 10:59:31 +01:00
Carl Schwan
ae73f7aaf5 refactor(setup-manager): Use ISetupManager instead of SetupManager
Keep using the OC API in the mount manager and OC_Utils, but the rest is
now using the public API.

Signed-off-by: Carl Schwan <carlschwan@kde.org>
2026-01-27 15:19:19 +01:00
Hamza
f1cdf6885e feat: add occ command to scan and selete orphaned keys
Signed-off-by: Hamza <hamzamahjoubi221@gmail.com>
2025-11-04 16:56:35 +01:00
Carl Schwan
a3442be054 refactor: fix psalm issues from encryption commands
Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
2025-10-01 16:07:41 +02:00
Côme Chilliet
8330f149b0 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-09 11:46:28 +02:00
Ferdinand Thiessen
5981b7eb51 chore: apply new CSFixer rules
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>

# Conflicts:
#	apps/settings/lib/SetupChecks/PhpOpcacheSetup.php
2025-07-01 16:26:50 +02:00
Robin Appelman
b0b8159d6a fix: throw a better error if we can't get the encrypted header size
Signed-off-by: Robin Appelman <robin@icewind.nl>
2025-05-09 22:33:45 +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
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
Faraz Samapoor
6b795da540 Uses early returns.
To improve code readability.

Signed-off-by: Faraz Samapoor <fsa@adlas.at>
2024-08-16 09:33:16 +02:00
Faraz Samapoor
fc8b886295 Refactors encryption app commands.
To improve code readability.

Signed-off-by: Faraz Samapoor <fsa@adlas.at>
2024-08-16 09:33:16 +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
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
Robin Appelman
e4f85226c5 extend fix-key-location to handle cases from broken cross-storage moves
Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-08-31 19:46:47 +02: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
49108880d2 Add fclose on opened resources
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-05-11 17:53:19 +02:00
Côme Chilliet
a92028f5cd Rename command to drop-legacy-filekey and remove comment about legacy mode.
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-05-11 11:56:14 +02:00
Côme Chilliet
36fc5dc8ae Copy data back instead of renaming to avoid changing the fileid
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-05-11 11:24:16 +02:00
Côme Chilliet
725403cb0d Copy and move files to migrate them to the new key
We have to rewrite the header, so the whole file needs to be rewritten,
 so we just use the same strategy as DecryptAll.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-05-09 12:02:57 +02:00
Côme Chilliet
146284f170 Fix fopen mode
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-05-04 17:50:34 +02:00
Côme Chilliet
5663f9b31e Add an occ command to scan files for legacy file key in use and get rid of those
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-05-04 16:53:25 +02:00
Vincent Petry
3bcbc4701a Merge pull request #34724 from nextcloud/encryption-read-before-cache
fix reading newly written encrypted files before their cache entry is written
2022-12-20 17:16:12 +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
e3a0e64698 clear is-encrypted cache when trying to fix encrypted version
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-12-01 14:36:27 +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
Robin Appelman
dd4ebbd72a add migration for encryption keys in wrong location
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-11-28 16:12:11 +01:00
Robin Appelman
06b2ed2641 skip files that cant be opened for FixEncryptedVersion
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-11-22 16:40:12 +01:00
Côme Chilliet
b20278f708 Fix encryption:fix-encrypted-version command when encrypted is set to 0
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-08-02 12:47:26 +02:00
Côme Chilliet
bd467e5d66 Improve typing in FixEncryptedVersion command
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-08-02 12:11:15 +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
Gary Kim
b78f3a57d1 Migrate HintException to OCP
Signed-off-by: Gary Kim <gary@garykim.dev>
2021-06-30 15:28:02 -04: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
6170912ace Fix warnings in FixEncryptedVersion command
Fixed code warnings

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2021-06-29 14:39:51 +02:00
Vincent Petry
4e9241c706 Detect disabled signature check when reparing
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>
2021-06-29 14:39:51 +02:00
Vincent Petry
a6dc81d419 Downstream encryption:fix-encrypted-version
For fixing "Bad signature" errors.

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
Christoph Wurst
d89a75be0b Update all license headers for Nextcloud 21
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-12-16 18:48:22 +01:00
essys
fdcfc4edce Update ScanLegacyFormat.php
Fixed a small typo on line 99.
2020-11-20 10:16:35 +01:00
Christoph Wurst
2a054e6c04 Update the license headers for Nextcloud 20
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-08-24 14:54:25 +02:00
Roeland Jago Douma
2bbb848c31 Add legacy scanning command
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-08-19 15:45:45 +02:00
Joas Schilling
d7c0b9cced Also always return in app commands
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-06-26 15:12:11 +02:00
Christoph Wurst
cb057829f7 Update license headers for 19
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-29 11:57:22 +02:00
Christoph Wurst
caff1023ea Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.

This also removes and empty lines from method/function bodies at the
beginning and end.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 14:19:56 +02:00
Christoph Wurst
41b5e5923a Use exactly one empty line after the namespace declaration
For PSR2

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-09 11:48:10 +02:00
Christoph Wurst
74936c49ea Remove unused imports
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-25 22:08:08 +01:00
Christoph Wurst
5bf3d1bb38 Update license headers
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-12-05 15:38:45 +01:00
Roeland Jago Douma
68748d4f85 Some php-cs fixes
* Order the imports
* No leading slash on imports
* Empty line before namespace
* One line per import
* Empty after imports
* Emmpty line at bottom of file

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-11-22 20:52:10 +01:00