Skip to content

fix(encryption): Refactor EncryptionWrapper#60344

Merged
cuppett merged 4 commits into
nextcloud:masterfrom
cuppett:cuppett/refactor-encryption-wrapper
May 18, 2026
Merged

fix(encryption): Refactor EncryptionWrapper#60344
cuppett merged 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 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
@cuppett cuppett force-pushed the cuppett/refactor-encryption-wrapper branch 2 times, most recently from 7fc34e6 to 6020482 Compare May 15, 2026 11:03
@cuppett cuppett enabled auto-merge May 15, 2026 11:51
cuppett and others added 4 commits May 16, 2026 06:13
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>
Signed-off-by: Stephen Cuppett <steve@cuppett.com>
@cuppett cuppett force-pushed the cuppett/refactor-encryption-wrapper branch from 6020482 to 52f7e3d Compare May 16, 2026 10:13
@cuppett
Copy link
Copy Markdown
Contributor Author

cuppett commented May 18, 2026

@artonge this is the reopen, thanks!

@cuppett cuppett merged commit 4082691 into nextcloud:master May 18, 2026
216 of 223 checks passed
@cuppett cuppett deleted the cuppett/refactor-encryption-wrapper branch May 18, 2026 19:44
@github-actions
Copy link
Copy Markdown
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

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) feedback-requested ♻️ 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.

3 participants