Files
wekan/models/lib/commentCardBoundary.js
T
Lauri Ojansivu d7ac619d63 Bind comment inserts to the authorized card board
Reject foreign-card REST and DDP comment inserts and prevent DDP rebinding from bypassing the boundary. Keep card-authoritative legacy comment listing. Add bounded Problems summaries and attack, negative insert inventory and browser regression coverage.

Targeted Node suites pass; browser regression is syntax-checked with live execution pending.

Thanks to Wenhao Wu, Southeast University and xet7 !
2026-09-14 11:49:40 +03:00

19 lines
639 B
JavaScript

'use strict';
function commentCardMatchesBoard(card, cardId, boardId) {
return Boolean(card && typeof cardId === 'string' && cardId &&
typeof boardId === 'string' && boardId &&
card._id === cardId && card.boardId === boardId);
}
function recordCommentBoundaryDenial(source) {
try {
require('/server/lib/securityLog').record({
key: 'authz.comment-card', action: 'blocked', source,
detail: 'Comment refused because its card does not belong to the requested board.',
});
} catch (e) { /* logging must never break the guard */ }
}
module.exports = { commentCardMatchesBoard, recordCommentBoundaryDenial };