Skip to content

fix(files): Prevent corruption of files when moving from encrypted to unencrypted folders within the same object storage - #62364

Open
DerDreschner wants to merge 1 commit into
masterfrom
fix/prevent-s3-corruption
Open

fix(files): Prevent corruption of files when moving from encrypted to unencrypted folders within the same object storage#62364
DerDreschner wants to merge 1 commit into
masterfrom
fix/prevent-s3-corruption

Conversation

@DerDreschner

@DerDreschner DerDreschner commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

When using server-side encryption (SSE), not all folders are encrypted by default. For example, when using groupfolders, the encryption must be enabled separately. This is described in the admin manual, but might not always being recognized by the administrators. This can then lead to situations where the personal folders are encrypted, but group folders might not.

This will lead to a bug when both folders are inside the same object storage (since #47986). In this case, the current code will try to speed up things by only copying the metadata in the filecache. This breaks the encryption, as the encryption key depends on the path of the file and isn't being moved in this case, nor any re-encryption happens for the new path. Before #62255, the user might be even served the raw file with the ciphertext in some cases.

To fix the issue, I'll let the global functions handle those cases rather then try to duplicate any logic into the object storage overwrite.

Checklist

AI (if applicable)

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

@DerDreschner

DerDreschner commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

/backport to stable34

@DerDreschner

Copy link
Copy Markdown
Contributor Author

/backport to stable33

@DerDreschner

Copy link
Copy Markdown
Contributor Author

/backport to stable32

@DerDreschner DerDreschner self-assigned this Jul 21, 2026
@DerDreschner
DerDreschner enabled auto-merge July 21, 2026 13:43
@DerDreschner DerDreschner added bug and removed bug labels Jul 21, 2026
@DerDreschner
DerDreschner requested review from artonge and susnux July 22, 2026 14:54
… unencrypted folders within the same object storage

Assisted-by: ClaudeCode:claude-opus-4-8
Signed-off-by: David Dreschner <david.dreschner@nextcloud.com>
@DerDreschner
DerDreschner force-pushed the fix/prevent-s3-corruption branch from 54078e2 to 672542f Compare July 24, 2026 10:44
@DerDreschner

Copy link
Copy Markdown
Contributor Author

/backport! to stable32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants