mirror of
https://github.com/wekan/wekan.git
synced 2026-11-25 10:48:06 -05:00
146d58df27 created models/lib/boardBackground.js for isOwnBoardBackground - but
that file already existed: computeBoardBackground, which the client uses to
switch board backgrounds (#4978). Overwriting it broke background switching in
the UI and tests/boardBackground.test.cjs. The original is restored, and the
BackgroundBleed rule lives in models/lib/boardBackgroundOwnership.js, used by
both download paths and the Boards deny rule.
Thanks to xet7 !
18 lines
922 B
JavaScript
18 lines
922 B
JavaScript
'use strict';
|
|
// BackgroundBleed (2026-10-02): a board's background is one of that board's
|
|
// own attachments. Both background download APIs (the api.board.downloadBackground
|
|
// method and GET /api/attachment/download-background/:boardId) answered with
|
|
// whatever attachment board.backgroundImageId named, checking only that the
|
|
// caller is a member of the board - and a board admin could set that field to
|
|
// ANY attachment id, so anyone could create a board, point its background at
|
|
// an attachment on someone else's private board, and download it.
|
|
// Pure: tests/backgroundBleed.test.cjs.
|
|
const { isLiveAttachment } = require('./attachmentSoftDelete');
|
|
|
|
function isOwnBoardBackground(board, attachment) {
|
|
return !!board && !!attachment && !!attachment.meta && typeof board._id === 'string' &&
|
|
attachment.meta.boardId === board._id && isLiveAttachment(attachment);
|
|
}
|
|
|
|
module.exports = { isOwnBoardBackground };
|