mirror of
https://github.com/wekan/wekan.git
synced 2026-01-08 18:48:50 +01:00
Fix SECURITY ISSUE 2: Access to boards of any Orgs/Teams, and avatar permissions.
Thanks to Siam Thanat Hack (STH) !
This commit is contained in:
parent
e9a727301d
commit
f26d582018
9 changed files with 347 additions and 49 deletions
|
|
@ -1,7 +1,7 @@
|
|||
template(name="userAvatar")
|
||||
a.member(class="js-{{#if assignee}}assignee{{else}}member{{/if}}" title="{{userData.profile.fullname}} ({{userData.username}}) {{_ memberType}}")
|
||||
if userData.profile.avatarUrl
|
||||
img.avatar.avatar-image(src="{{userData.profile.avatarUrl}}")
|
||||
img.avatar.avatar-image(src="{{avatarUrl}}")
|
||||
else
|
||||
+userAvatarInitials(userId=userData._id)
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,21 @@ Template.userAvatar.helpers({
|
|||
});
|
||||
},
|
||||
|
||||
avatarUrl() {
|
||||
const user = ReactiveCache.getUser(this.userId, { fields: { profile: 1 } });
|
||||
const base = (user && user.profile && user.profile.avatarUrl) || '';
|
||||
if (!base) return '';
|
||||
// Append current boardId when available so public viewers can access avatars on public boards
|
||||
try {
|
||||
const boardId = Utils.getCurrentBoardId && Utils.getCurrentBoardId();
|
||||
if (boardId) {
|
||||
const sep = base.includes('?') ? '&' : '?';
|
||||
return `${base}${sep}boardId=${encodeURIComponent(boardId)}`;
|
||||
}
|
||||
} catch (_) {}
|
||||
return base;
|
||||
},
|
||||
|
||||
memberType() {
|
||||
const user = ReactiveCache.getUser(this.userId);
|
||||
return user && user.isBoardAdmin() ? 'admin' : 'normal';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue