Files
wekan/server/lib/migrationBoardAccess.js
T
Lauri Ojansivu ebcd02be6f Hall of Fame regression audit: every fixed vulnerability still fixed, siblings of six of them closed.
Every Hall of Fame vulnerability without a test naming it (24 names, 30
advisories) was checked against the current source. No fix had been
reverted. Looking for the same mistake elsewhere found siblings:

- FloppyBleed: the fs-path-heal upgrade step joined an attachment's
  stored name into candidate paths as-is; a record a client inserted
  named ../../../etc/passwd made the next upgrade copy that file into
  storage - an arbitrary file read. Only the name's last component is
  used now; the bulk move limits a legacy name's extension the same way.
- FilePathBleed (GHSA-g6vm-7757-pr88): the insert guard looked only
  inside versions; with versions left out ostrio:files falls back to a
  top-level path, which removing the record deletes and validation
  reads. A client's top-level path is refused for attachments and
  avatars, recorded by the existing canaries.
- MoveStorageBleed: validateAttachment, which deletes a file failing the
  current upload rules, was open to anybody who could see the board, a
  public one included. Only who may change the file, or a site admin,
  validates now; a refusal is recorded (authz.attachment-validate).
- HookUrlBleed / IntegrationBleed: the REST reads of a board's
  integrations gave the webhook URL - whose path is its secret - to
  every member reading the board; non-admins get what the publication
  gives them.
- AttachmentMigrationBleed: four migration methods answered any
  logged-in user about any board, deleteDuplicateEmptyLists.getStatus
  with a private board's list titles; they require a visible board and
  record refusals (authz.migration-board).
- LegacyAttachBleed (GHSA-xcxp-hx9w-q5q9) and MimeStorageBleed
  (GHSA-rv5g-5p4g-3v89): the legacy route judged a name dangerous only
  for .svg, the response policy missed x-javascript, ecmascript, xsl and
  +xml types, and the sniffers missed <tag/onx= handlers.

OIDCBleed refusals are now recorded in Admin Panel / Problems too. New
suites name the vulnerabilities they guard, existing ones name the
advisories they already covered, and tests/securityRegressionCoverage
counts 128 of 137 published vulnerabilities with a named test (was 125).

Thanks to xet7 !
2026-10-27 16:28:12 +02:00

34 lines
1.7 KiB
JavaScript

import { Meteor } from 'meteor/meteor';
import { ReactiveCache } from '/imports/reactiveCache';
// AttachmentMigrationBleed (SnowBleed, fixed in v8.21): the board-scoped
// migration methods answered any logged-in user about ANY board - the
// attachmentMigration.* methods were given a board visibility check then
// (server/attachmentMigration.js). Three siblings kept the same shape, a login
// check alone: deleteDuplicateEmptyLists.getStatus returned every list id and
// title of a private board with card counts, and its .needsMigration,
// fixAllFileUrls.needsMigration and fixAvatarUrls.needsMigration answered
// questions about a board the caller cannot see (and made the server scan its
// cards). They now refuse a board the caller cannot see, like the
// attachmentMigration ones.
//
// No WeKan client calls these four, so a refusal is an attempt, not ordinary
// use, and it is recorded (Admin Panel / Problems, AttachmentMigrationBleed).
// Throws unless `userId` may see `boardId`; returns the board.
export async function assertMigrationBoardVisible(userId, boardId, source) {
if (!userId) {
throw new Meteor.Error('not-authorized', 'You must be logged in');
}
const board = await ReactiveCache.getBoard(boardId);
if (!board || !board.isVisibleBy({ _id: userId })) {
try {
require('/server/lib/securityLog').record({
key: 'authz.migration-board', action: 'blocked', source,
detail: 'Asked a board migration method about a board the caller cannot see.',
});
} catch (e) { /* logging must never break the guard */ }
throw new Meteor.Error('not-authorized', 'You do not have access to this board.');
}
return board;
}