mirror of
https://github.com/wekan/wekan.git
synced 2026-01-02 23:58:49 +01:00
Security Fix 8: Attachments publication leaks metadata without auth.
Thanks to Joshua Rogers of joshua.hu, Twitter MegaManSec !
This commit is contained in:
parent
5cd875813f
commit
6dfa3beb2b
1 changed files with 28 additions and 1 deletions
|
|
@ -2,8 +2,35 @@ import Attachments from '/models/attachments';
|
|||
import { ObjectID } from 'bson';
|
||||
|
||||
Meteor.publish('attachmentsList', function(limit) {
|
||||
const userId = this.userId;
|
||||
|
||||
// Get boards the user has access to
|
||||
const userBoards = ReactiveCache.getBoards({
|
||||
$or: [
|
||||
{ permission: 'public' },
|
||||
{ members: { $elemMatch: { userId, isActive: true } } }
|
||||
]
|
||||
}).map(board => board._id);
|
||||
|
||||
if (userBoards.length === 0) {
|
||||
// User has no access to any boards, return empty cursor
|
||||
return this.ready();
|
||||
}
|
||||
|
||||
// Get cards from those boards
|
||||
const userCards = ReactiveCache.getCards({
|
||||
boardId: { $in: userBoards },
|
||||
archived: false
|
||||
}).map(card => card._id);
|
||||
|
||||
if (userCards.length === 0) {
|
||||
// No cards found, return empty cursor
|
||||
return this.ready();
|
||||
}
|
||||
|
||||
// Only return attachments for cards the user has access to
|
||||
const ret = ReactiveCache.getAttachments(
|
||||
{},
|
||||
{ 'meta.cardId': { $in: userCards } },
|
||||
{
|
||||
fields: {
|
||||
_id: 1,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue