actor_id column too small for federated chats
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2.2k
- Forks
- 586
- Avg merge
- 18h 27m
- Merged PRs (30d)
- 333
Description
How to use GitHub
- Please use the 👍 reaction to show that you are affected by the same issue.
- Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
- Subscribe to receive notifications on status change and new comments.
Summary
When using the federated chats the actor_id of the messages will be username@some-cloud-domain.tld which may be longer than the currently allowed limit of 64 chars. For local users it's fine since the uid of each user is also limited to 64 chars, but federated user IDs may need more chars cause of the domain added.
Steps to reproduce
- Use federated chat between two Nextcloud instances.
- Create a user with a long uid like 60 chars or so. (We have long user IDs originating from our SSO)
- Write something in a federated chat with that user.
- See that the user name is not displayed in the chat, but the federated user ID truncated to 64 chars. The user avatar is not shown as well.
Also see error messages in the logs that theactor_idis truncated and the truncated domain could not be resolved by the DNS (which makes sense).
Expected behaviour
The federated user ID should not be truncated and the user information should be displayed correctly in the chat.
Actual behaviour
The federated user ID is truncated to 64 chars on database insert at the actor_id columns. As a result the federated user cannot be resolved correctly and only the truncated ID is shown in the chat.
In the logs errors like the following can be found (note the missing domain ending cause of the truncate):
CannotReachRemoteException No DNS record found for cloud.some-domain
Also during the db inserts:
DbalException An exception occurred while executing a query: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'actor_id' at row 1
Talk app
Talk app version: 22.0.09
Custom Signaling server configured: yes 2.1.0
Custom TURN server configured: yes
Custom STUN server configured: yes
Server configuration
Operating system: Debian Trixie
Web server: Nginx
Database: MariaDB
PHP version: 8.3
Nextcloud Version: 32.0.5
Possible workaround
I've tried altering the tables to increase the size of the actor_id column.
ALTER TABLE oc_comments MODIFY actor_id VARCHAR(128) NOT NULL DEFAULT '';
ALTER TABLE oc_reactions MODIFY actor_id VARCHAR(128) NOT NULL DEFAULT '';
ALTER TABLE oc_talk_proxy_messages MODIFY actor_id VARCHAR(128) NOT NULL;
(There are some other tables with 64 chars actor_id too.)
After this change the federated chat with long federated user IDs seems to be working fine.
Additionally I was able to recover old messages by adding the missing parts to the actor_id entries in oc_comments and oc_talk_proxy_messages.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the oc_comments, oc_reactions, and oc_talk_proxy_messages tables and reproduce the federated-chat flow using an actor_id longer than 64 characters. Done means the full federated user ID survives database inserts, the user name and avatar display correctly, and the related truncation and DNS errors no longer occur.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mariadb, php
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100