fix(wopi): stable guest UserId and correct IsAnonymousUser for named guests#5601
fix(wopi): stable guest UserId and correct IsAnonymousUser for named guests#5601Arildm-no wants to merge 2 commits into
Conversation
joshtrichards
left a comment
There was a problem hiding this comment.
Good catch! Makes sense.
I'm surprised I can't find any open bug reports on this topic.
Anyhow, from my end, as noted, I'd just like to see the output bumped up from the hash.
P.S. #2170 impacts this too (I assume). But that's not guest specific - and, more importantly, this is still a good improvement. And, presumably guests will likely also benefit from whatever eventually targets #2170 anyhow (by virtue of this change).
4f553df to
e93e9c8
Compare
|
Thanks for the thorough review, @joshtrichards! Both requested changes have been applied:
|
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
…guests Two issues prevented cursor presence from working for named public link guests: 1. Guest UserId was randomly generated on every CheckFileInfo call. The WOPI spec requires UserId to be stable per user session. Use a deterministic hash of the WOPI token instead so the same guest retains the same identity for the duration of the session. 2. IsAnonymousUser was unconditionally set to true for all public link users, even when the guest had explicitly entered a display name. Collabora treats IsAnonymousUser=true as a privacy signal and hides the cursor from other editors. Only set the flag when the guest has no display name (truly anonymous), so named guests have visible cursors in collaborative sessions. Signed-off-by: Arildm-no <arild.marthinsen@gmail.com>
Addresses review feedback: bumps substr length from 8 to 16 hex chars (64-bit) for Birthday Paradox mitigation on guest UserId generation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Arildm-no <arild.marthinsen@gmail.com>
e93e9c8 to
e903365
Compare
|
Added |
Problem
Two bugs in
WopiController::checkFileInfo()prevent cursor presence from working when a named guest edits a document via a public link alongside a logged-in user.Bug 1 — Guest
UserIdis randomly generated on every WOPI callThe WOPI protocol requires
UserIdto be stable for the duration of a session. Collabora callsCheckFileInfomultiple times (e.g. on token refresh), and each call returned a different random ID for the same guest. Collabora treats each new ID as a new user, breaking cursor tracking and view presence entirely.Bug 2 —
IsAnonymousUseris unconditionallytruefor all public link usersCollabora interprets
IsAnonymousUser = trueas a privacy signal and hides that user's cursor from other editors. This is correct for a truly anonymous viewer (no name entered), but wrong for a guest who has explicitly entered a display name in the Nextcloud sharing prompt.Fix
UserIddeterministically from the WOPI token using SHA-256, so the same guest token always maps to the same identity within a session.IsAnonymousUser = truewhen the guest has no display name. Named guests getfalse, enabling cursor visibility.Steps to reproduce
Expected behaviour
Named guests have a visible, coloured cursor indicator, just like any other named collaborator.
Tested on