Files
wekan/models/lib/historyReadScope.js
T
Lauri Ojansivu 285c1db24f Enforce current access when reading and restoring universal History
Filter historical rows before search, counts and contributor aggregation using current board visibility and assigned-card scope. Gate all reversal paths with the same scope and current card/linked-card edit permission so revoked access or an old board cannot authorize hidden-card writes.

Verified 10 focused Node runner entries and eight Chromium scenarios across History and rule undo/redo, including allowed restores and negative cases. Document detection limits to avoid treating legitimate stale permissions as attributable attacks.

Thanks to xet7 !
2026-09-27 17:38:27 +03:00

13 lines
556 B
JavaScript

'use strict';
// Current access wins over authorship and over the scope a client selected.
// Restricted members only receive history belonging to a currently visible
// card; container snapshots can contain other cards and must not slip through.
function readableHistoryRow(row, scope) {
if (!scope || !scope.visible) return false;
if (!scope.assignedOnly) return true;
const cardId = row.cardId || (row.entityType === 'card' ? row.entityId : null);
return Boolean(cardId && scope.cardIds.has(cardId));
}
module.exports = { readableHistoryRow };