Skip to content

[stable34] fix(encryption): keep version and size in sync for files not in the cache - #64484

Merged
susnux merged 1 commit into
stable34from
backport/64365/stable34
Sep 20, 2026
Merged

susnux merged 1 commit into
stable34from
backport/64365/stable34

Conversation

@backportbot

@backportbot backportbot Bot commented Sep 17, 2026

Copy link
Copy Markdown

Backport of #64365

Warning, This backport's changes differ from the original and might be incomplete ⚠️

Todo

  • Review and resolve any conflicts
  • Review and verify the backported changes
  • Amend HEAD commit to remove the line stating to skip CI

Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

@backportbot backportbot Bot added this to the Nextcloud 34.0.5 milestone Sep 17, 2026
@susnux
susnux force-pushed the backport/64365/stable34 branch from 6303db0 to 03585ae Compare September 20, 2026 12:44
@susnux
susnux marked this pull request as ready for review September 20, 2026 12:46
@susnux
susnux requested a review from a team as a code owner September 20, 2026 12:46
@susnux
susnux requested review from icewind1991 and leftybournes and removed request for a team September 20, 2026 12:46
…ache

A file written through a stream has no file cache entry until the caller
scans it, but both inputs of the block signature are read from that entry:
stream_close() can only bump `encryptedVersion` if the entry exists, while
the reader got version 0 instead of the 1 the blocks were signed with, and
filesize() returned the wrapped storage's ciphertext size, which moved the
'end' position marker to the wrong block. Reading such a file back - e.g.
moving a part file to a target on another storage - failed with
"Bad Signature".

Treat a missing version as 1 on read, and let the size tracked while
writing win over the wrapped storage's size even without a cache entry.
Also stop reading `encryptedVersion` off a missing source entry when
updating the encrypted version of a copy or rename.

Assisted-by: ClaudeCode:claude-opus-5
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@susnux
susnux force-pushed the backport/64365/stable34 branch from 03585ae to 7ce46be Compare September 20, 2026 22:05
@susnux
susnux merged commit a46200a into stable34 Sep 20, 2026
153 checks passed
@susnux
susnux deleted the backport/64365/stable34 branch September 20, 2026 22:21
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