mirror of
https://github.com/wekan/wekan.git
synced 2026-11-26 01:49:41 -05:00
The Checklists and ChecklistItems collection allow rules authorize an update only against the document's CURRENT (source) cardId. A DDP client with write access to its own board could move a checklist/item it owns onto a card in a private board it is not a member of by $set-ting a new cardId (and, for items, checklistId); the before.update hook then denormalizes boardId from the destination card, attaching the attacker-controlled document to the victim's private board. Same class as denyCrossBoardMove / BoardBleed (GHSA-gm7v-pc38-53jr), but for the card-attached checklist documents that the boardId-only deny did not cover. Add denyCrossBoardMoveByCard and denyCrossBoardMoveByChecklistItem in server/lib/utils.js, which reject any update whose destination board (resolved from a new boardId, cardId, or checklistId in the modifier) the caller cannot write to, and wire them into Checklists.deny / ChecklistItems.deny. Legitimate moves into writable boards and same-card edits are unaffected; the server-side moveChecklist Meteor method bypasses allow/deny and is unchanged. Adds a regression test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
32 lines
1.3 KiB
JavaScript
32 lines
1.3 KiB
JavaScript
import Cards from '/models/cards';
|
|
import Checklists from '/models/checklists';
|
|
import { allowIsBoardMemberWithWriteAccessByCard, denyCrossBoardMoveByCard } from '/server/lib/utils';
|
|
|
|
Checklists.allow({
|
|
async insert(userId, doc) {
|
|
// ReadOnly users cannot create checklists
|
|
return await allowIsBoardMemberWithWriteAccessByCard(userId, await Cards.findOneAsync(doc.cardId));
|
|
},
|
|
async update(userId, doc) {
|
|
// ReadOnly users cannot edit checklists
|
|
return await allowIsBoardMemberWithWriteAccessByCard(userId, await Cards.findOneAsync(doc.cardId));
|
|
},
|
|
async remove(userId, doc) {
|
|
// ReadOnly users cannot delete checklists
|
|
return await allowIsBoardMemberWithWriteAccessByCard(userId, await Cards.findOneAsync(doc.cardId));
|
|
},
|
|
fetch: ['userId', 'cardId'],
|
|
});
|
|
|
|
// Security (GHSA-gv8h-5p3p-6hx7): the allow rule above only checks write access
|
|
// on the checklist's SOURCE card/board, so a DDP client could move a checklist
|
|
// into a private board it is not a member of by $set-ting a new cardId (the
|
|
// Checklists.before.update hook then denormalizes boardId from that destination
|
|
// card). Deny any move whose destination board the caller cannot write to.
|
|
Checklists.deny({
|
|
async update(userId, doc, fieldNames, modifier) {
|
|
return await denyCrossBoardMoveByCard(userId, modifier);
|
|
},
|
|
fetch: [],
|
|
});
|