Skip to content

fix(encryption): use the block size of the file encoding when fixing sizes - #65426

Merged
skjnldsv merged 1 commit into
masterfrom
fix/encryption-legacy-unencrypted-size
Oct 13, 2026
Merged

skjnldsv merged 1 commit into
masterfrom
fix/encryption-legacy-unencrypted-size

Conversation

@susnux

@susnux susnux commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

fixUnencryptedSize() asked the encryption module for the unencrypted block size before calling begin().
The module only knows the encoding of the file (binary or legacy base64) from the header in begin(), so the block size of binary encoded files was used for legacy base64 files.

This stored an inflated unencrypted size for legacy files, which then breaks downloads: the announced content length is too large and the signature check of the last block fails with "Bad Signature".

Checklist

AI (if applicable)

Tests created with help of Claude Code.

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

…sizes

`fixUnencryptedSize()` asked the encryption module for the unencrypted
block size before calling `begin()`. The module only learns the encoding
of the file (binary or legacy base64) from the header in `begin()`, so
the block size of binary encoded files was used for legacy base64 files.

This stored an inflated unencrypted size for legacy files, which then
breaks downloads: the announced content length is too large and the
signature check of the last block fails with "Bad Signature".

Fixes #63662

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@susnux susnux added this to the Nextcloud 36 milestone Oct 12, 2026
@susnux
susnux requested a review from a team as a code owner October 12, 2026 15:00
@susnux
susnux requested review from GhassenKefi, icewind1991, provokateurin, salmart-dev and sorbaugh and removed request for a team and sorbaugh October 12, 2026 15:00
@susnux

susnux commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

/backport to stable35

@susnux

susnux commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

/backport to stable34

@susnux

susnux commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

/backport to stable33

@skjnldsv skjnldsv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me! Though seems over-powered to have such precise occ command 😁

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.

Wrong unencrypted_size for legacy base64 files: block size is read before the file header is applied

4 participants