fix: IDOR on console GET /account/avatar#35771
Merged
asukaminato0721 merged 1 commit intoMay 3, 2026
Merged
Conversation
…awareness end-to-end Signed-off-by: NeatGuyCoding <15627489+NeatGuyCoding@users.noreply.github.com>
GET /account/avatarGET /account/avatar
GET /account/avatarGET /account/avatar
asukaminato0721
approved these changes
May 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
Fixes #<issue number>.Summary
Fixes an insecure direct object reference (IDOR) on
AccountAvatarApi.get: the handler previously signed any caller-suppliedavatarupload file ID viafile_helpers.get_signed_file_urlwithout verifying that the file belongs to the current workspace tenant and the current console account.The endpoint now loads
UploadFileby id, requirestenant_idto matchcurrent_account_with_tenant()’s tenant, requirescreated_by_role == ACCOUNTandcreated_by == current_user.id, and only then signs withupload_file_id=. Absolutehttp:///https://avatar values are returned unchanged (aligned withfields/member_fields.py_build_avatar_url).Security fix
upload_files(tenant_id,created_by,created_by_role).NotFound) to limit enumeration leakage.Technical details
Before (vulnerable):
After (fixed):
Screenshots
upload_files.idvia query paramTesting
TestAccountAvatarApiGetindify/api/tests/unit_tests/controllers/console/workspace/test_accounts.py.cd dify/api && uv run pytest tests/unit_tests/controllers/console/workspace/test_accounts.py::TestAccountAvatarApiGet -vFiles changed
dify/api/controllers/console/workspace/account.py—AccountAvatarApi.getauthorization + imports (NotFound,UploadFile,CreatorUserRole).dify/api/tests/unit_tests/controllers/console/workspace/test_accounts.py—TestAccountAvatarApiGet.Checklist
make lint && make type-check(backend) andcd web && pnpm exec vp staged(frontend) to appease the lint godsRelated issue
Fixes #35770