mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
Triggers, Actions, Rules and Integrations were allowed to a board admin of the board the document was on BEFORE an update; nothing refused the update itself changing boardId. Any registered user, admin of a board they created, could move a rule trigger to '*' or unset its board - which the rule matcher matched on every board - and have a send-email action mail them cards, comments and attachments from every private board; or move a webhook integration onto a private board and receive its activity, or rewrite its comments through a two-way hook. Custom fields accepted a board list if the caller could write to ANY board in it, so a field could be planted on (or pulled from) a board without access; comment reactions could be moved onto another comment. A shared deny rule now refuses any client update that changes those documents' board, custom fields need write access on every board they are put on or taken off, and the rule matcher runs a rule only for activity on its own board. Refusals record RepointBleed in Admin Panel -> Problems (high: no client changes these fields). Unit, negative (every board-owned permissions file) and browser tests. Thanks to xet7 !
29 lines
966 B
JavaScript
29 lines
966 B
JavaScript
import Boards from '/models/boards';
|
|
import Integrations from '/models/integrations';
|
|
import { allowIsBoardAdmin } from '/server/lib/utils';
|
|
import { denyBoardRepoint } from '/server/lib/boardRepointGuard';
|
|
|
|
const permissionHelper = {
|
|
async allow(userId, doc) {
|
|
const user = await Meteor.users.findOneAsync(userId);
|
|
const isAdmin = user && user.isAdmin;
|
|
return isAdmin || allowIsBoardAdmin(userId, await Boards.findOneAsync(doc.boardId));
|
|
},
|
|
};
|
|
Integrations.allow({
|
|
async insert(userId, doc) {
|
|
return await permissionHelper.allow(userId, doc);
|
|
},
|
|
async update(userId, doc) {
|
|
return await permissionHelper.allow(userId, doc);
|
|
},
|
|
async remove(userId, doc) {
|
|
return await permissionHelper.allow(userId, doc);
|
|
},
|
|
fetch: ['boardId'],
|
|
});
|
|
|
|
// RepointBleed: the allow rule above checks the board the document is on now;
|
|
// this refuses an update that moves it to another board.
|
|
Integrations.deny(denyBoardRepoint('integrations'));
|