mirror of
https://github.com/wekan/wekan.git
synced 2026-11-25 04:49:41 -05:00
Add bounded, attributed Problems events for denied MiniProfileBleed, PositionHistoryBleed, and CasBleed attempts. Keep UserSearchBleed and SubtaskExportBleed silent because their safe paths are indistinguishable from ordinary use. Also prevent clients from rewriting validated position history.
33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
import UserPositionHistory from '/models/userPositionHistory';
|
|
import Boards from '/models/boards';
|
|
import { tripCanary } from '/server/lib/canary';
|
|
|
|
UserPositionHistory.allow({
|
|
async insert(userId, doc) {
|
|
if (!userId || doc.userId !== userId) {
|
|
return tripCanary('history.cross-board', { userId });
|
|
}
|
|
const board = await Boards.findOneAsync(doc.boardId);
|
|
if (!board || !board.hasMember(userId)) {
|
|
return tripCanary('history.cross-board', { userId });
|
|
}
|
|
if (doc.previousBoardId) {
|
|
const previousBoard = await Boards.findOneAsync(doc.previousBoardId);
|
|
if (!previousBoard || !previousBoard.hasMember(userId)) {
|
|
return tripCanary('history.cross-board', { userId });
|
|
}
|
|
}
|
|
return true;
|
|
},
|
|
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'],
|
|
});
|