Skip to content

fix(encryption): Refactor EncryptionWrapper#60344

Open
cuppett wants to merge 4 commits into
nextcloud:masterfrom
cuppett:cuppett/refactor-encryption-wrapper
Open

fix(encryption): Refactor EncryptionWrapper#60344
cuppett wants to merge 4 commits into
nextcloud:masterfrom
cuppett:cuppett/refactor-encryption-wrapper

Conversation

@cuppett
Copy link
Copy Markdown
Contributor

@cuppett cuppett commented May 13, 2026

Summary

Rewrite conditional flow to use early-return guards: skip IDisableEncryptionStorage, skip the root mount.

Spawned from #60001

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

cuppett and others added 3 commits May 13, 2026 05:52
Rewrite conditional flow to use early-return guards: skip IDisableEncryptionStorage,
skip the root mount, respect encryptHomeStorage for HomeMountPoints. Uses IAppConfig
for the encryptHomeStorage setting with a legacy string fallback for the upgrade window.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Stephen Cuppett <steve@cuppett.com>
Signed-off-by: Stephen Cuppett <steve@cuppett.com>
…tion creation

Injecting IAppConfig as a constructor parameter into Encryption\Manager (and
through it into EncryptionWrapper) caused IDBConnection to be eagerly resolved
during OC::init() on PHP <8.4 (no lazy ghost objects). This happened before
maintenance:install's Sqlite::initialize() wrote dbname to config.php, so the
connection latched onto the default database name ('owncloud') instead of the
configured one ('nextcloud'). All migrations then ran against owncloud.db, and
the subsequent enable_all.php process opened an empty nextcloud.db — crashing
with "no such table: oc_appconfig".

Remove IAppConfig from Manager's constructor and Server.php's factory closure.
Resolve it lazily via Server::get(IAppConfig::class) inside
EncryptionWrapper::wrapStorage(), which is only called after the filesystem is
set up, never during bootstrap.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Stephen Cuppett <steve@cuppett.com>
@cuppett cuppett requested a review from a team as a code owner May 13, 2026 09:56
@cuppett cuppett requested review from ArtificialOwl, artonge, come-nc, leftybournes, miaulalala and salmart-dev and removed request for a team May 13, 2026 09:56
@cuppett cuppett added this to the Nextcloud 34 milestone May 13, 2026
@cuppett cuppett added 3. to review Waiting for reviews feature: encryption (server-side) ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring) labels May 13, 2026
@cuppett cuppett changed the title Cuppett/refactor encryption wrapper fix(encryption): Refactor EncryptionWrapper May 13, 2026
Signed-off-by: Stephen Cuppett <steve@cuppett.com>
@cuppett cuppett force-pushed the cuppett/refactor-encryption-wrapper branch from ce5e1cd to 7fc34e6 Compare May 13, 2026 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews feature: encryption (server-side) ♻️ refactor Refactor code (not a bug fix, not a feature just refactoring)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant