fix: 🐛 🔧 Widen DB field uids for federated sharing#5441
fix: 🐛 🔧 Widen DB field uids for federated sharing#5441
Conversation
…d IDs When a federated cloud ID exceeds 64 characters, the owner_uid and editor_uid columns in oc_richdocuments_wopi silently truncate the value, which can prevent federated users from opening documents in Collabora. Widen both columns from varchar(64) to varchar(255) to accommodate the full length of federated cloud IDs in the format user@remote.domain. Signed-off-by: James Manuel <moodyjmz@users.noreply.github.com>
e5b9912 to
910cbc5
Compare
|
@juliusknorr I am not sure if we should make this change into the original migration file too. Also I am not sure about backporting. |
|
One more question though, is 255 long enough? |
That is what I've seen talk and files using. @nickvergessen @ArtificialOwl do you have any further insights there? Technically the federated cloud id could be longer then 255 characters if you are using a long domain name. https://github.com/nextcloud/spreed/blob/b5d2a951863852f25ffe6aca2f43f8881288b570/lib/Migration/Version19000Date20240214095011.php#L39 |
Yes, we can backport this as the tables have only temporary entires so even on larger scale systems the backported migration would not cause longer downtimes on schema changes). For the backporting process i can guide you through it. Chaning the size in the original migration as well will be faster on initial installations as then only the first one would need to run and the others can be skipped. Less db operations to get the schema setup initially. |
|
from what I see, the length of the UID can be 64 server/lib/public/IUser.php:24 public const MAX_USERID_LENGTH = 64; and the max for a domain is 253 So, could be 318... I think - just to be clear = adding the @ sign to get to 318 |
|
@juliusknorr So I should update the original migration file here as well?
|
Uids in several fields are not long enough for names, this shifts length 64 >>>255
Summary
When a federated cloud ID exceeds 64 characters, the
owner_uidandeditor_uidcolumns in theoc_richdocuments_wopitable silently truncate the value. This can prevent federated users from opening documents in Collabora.This PR adds a database migration to widen
owner_uidandeditor_uidfromvarchar(64)tovarchar(255), aligning them with the maximum length of a federated cloud ID (user@remote).Background
The
oc_richdocuments_wopitable stores active Collabora editing sessions. Theowner_uidcolumn identifies the file owner andeditor_uididentifies the current editor. In a federation context, these values may contain a full cloud ID in the formatuser@remote.domain, which can easily exceed 64 characters with longer usernames or domain names.The columns were originally defined as
varchar(64)inVersion2060Date20200302131958, which matches the local Nextcloud user ID limit but does not account for federated cloud IDs.Changes
New migration:
Version10100Date20260226000000owner_uidfromvarchar(64)tovarchar(255)onoc_richdocuments_wopieditor_uidfromvarchar(64)tovarchar(255)onoc_richdocuments_wopinull(no-op) if the table or columns do not exist or are already the correct sizeAffected table
oc_richdocuments_wopiowner_uidvarchar(64)varchar(255)oc_richdocuments_wopieditor_uidvarchar(64)varchar(255)Notes
uidcolumns inoc_richdocuments_directandoc_richdocuments_assetsare alsovarchar(64)but currently only store local user IDs ($this->userId), so they are not affected by this issue. They can be addressed separately if needed.Version2060Date20200302131958) could also be updated to usevarchar(255)for these columns so that fresh installations get the correct size immediately.TODO
Checklist