Files
wekan/server/permissions/userPositionHistory.js
T
Lauri Ojansivu 3d080956be Close the PositionHistoryBleed sibling: no client-written history, and undo/redo stay within the entry's boards.
Clients could insert position-history entries as long as the entry's boardId
and previousBoardId were boards they belonged to. Nothing tied the entry's
card, list, swimlane or checklist item to those boards, and redo had no check
at all, so a member could forge an entry naming another board's card - or a
newBoardId, or a delete/restore action - and undo/redo would move it into
their own board or soft-delete another board's list with its cards.

The server records history itself (trackChange), so client inserts are now
refused outright. Undo and redo first check that the entity is still on one of
the entry's own boards (a cross-board card move is recorded under the board it
left) and that the user can write there and on the destination. Refusals trip
the existing history.cross-board canary. Unit and browser tests; the test that
pinned the weaker insert rule pins the stronger one.

Thanks to xet7 !
2026-10-02 11:04:02 +03:00

25 lines
1016 B
JavaScript

import UserPositionHistory from '/models/userPositionHistory';
import { tripCanary } from '/server/lib/canary';
UserPositionHistory.allow({
insert(userId) {
// PositionHistoryBleed, sibling (2026-10-02): history entries are recorded
// by the server (trackChange) when a change really happens; no client
// inserts one. Allowing it - even with board checks on boardId and
// previousBoardId - let a member forge an entry naming any card, list or
// checklist item by id, with any newBoardId or actionType, and then have
// undo/redo move it into their board or soft-delete it.
return tripCanary('history.cross-board', { userId });
},
update(userId) {
// Server-side checkpoint updates bypass allow rules. A client must never be
// able to rewrite a trusted undo destination after insert validation.
return tripCanary('history.cross-board', { userId });
},
remove() {
// Don't allow removal - history is permanent
return false;
},
fetch: ['userId'],
});