mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 18:10:06 -05:00
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 !
19 lines
639 B
JavaScript
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 };
|