dify icon indicating copy to clipboard operation
dify copied to clipboard

Uploaded avatars return 404 for other users in workflow collaboration

Open hjlarry opened this issue 2 weeks ago • 2 comments

Self Checks

  • [x] I have read the Contributing Guide and Language Policy.
  • [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
  • [x] I have searched for existing issues search for existing issues, including closed ones.
  • [x] I confirm that I am using English to submit this report, otherwise it will be closed.
  • [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • [x] Please do not modify this template :) and fill in all the required fields.

Dify version

1.19

Cloud or Self Hosted

Self Hosted

Steps to reproduce

  1. Use two accounts with edit access to the same workflow in a workspace with collaboration enabled.
  2. Upload a profile image for the first account.
  3. Open the same workflow editor with both accounts and wait for the first account to appear in the second account’s online collaborator list.
  4. Check the first account’s avatar in the editor header and inspect the avatar request in the second account’s browser.

✔️ Expected Behavior

Both accounts can see each other’s uploaded profile images in the header and the expanded online collaborator list.

❌ Actual Behavior

The second account sees initials in place of the uploaded image. The avatar request fails with:

GET /console/api/account/avatar?avatar=<uploaded-avatar-file-id>
404 Avatar file not found

Workflow presence sends the stored profile avatar, which is a file ID for an uploaded image. The header resolves that ID using the viewer’s session. Since #35771, the account avatar endpoint signs uploads only for the uploading account, so it returns 404 for another room member even when both users can edit the workflow. Existing HTTP(S) avatars still render because the account endpoint returns those URLs directly.

hjlarry avatar Nov 18 '26 07:11 hjlarry

There is already a reusable serialization path for this: workspace member responses expose avatar_url through build_avatar_url(), which preserves HTTP(S) URLs and signs uploaded avatar IDs. [1] [2]

A targeted fix would be to expose a resolved avatar_url in the authorized collaboration presence payload and have OnlineUsers render it directly, rather than resolving another account’s upload through the viewer’s /account/avatar endpoint. The room join already validates workspace/app access, and broadcast_online_users() is the payload emission point. [3] [4] [5]

Keep the account endpoint’s ownership restriction intact: #35771 introduced it to prevent signing arbitrary upload IDs. Suggested regression coverage: another authorized collaborator’s uploaded avatar renders in both views, external URLs and initials still work, and direct requests for another account’s upload remain rejected. [6]

To reply, just mention @dosu.


Docs are dead. Just use Dosu.

Leave Feedback Ask Dosu about dify

dosubot[bot] avatar Nov 18 '26 07:11 dosubot[bot]

Good catch on #35771. The regression is in AccountAvatarApi / AccountService: querying UploadFile explicitly enforces UploadFile.created_by == current_user.id, which drops User A's uploaded file ID when requested by User B during collaboration presence broadcast.

grinem avatar Nov 18 '26 08:11 grinem