mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 20:45:00 -05:00
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 !
75 lines
2.9 KiB
JavaScript
75 lines
2.9 KiB
JavaScript
'use strict';
|
|
|
|
// Regression coverage for SearchBleed (GHSA-33h9-rc5h-667p, CWE-943):
|
|
// authenticated clients could replace the server's board-scoped global-search
|
|
// selector; execution operators are now rejected before database access and
|
|
// initial and stored pagination selectors are constrained to board access.
|
|
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
|
|
const root = path.resolve(__dirname, '..');
|
|
const cards = fs.readFileSync(
|
|
path.join(root, 'server/publications/cards.js'),
|
|
'utf8',
|
|
);
|
|
|
|
assert.match(
|
|
cards,
|
|
/import \{ MATCH_NOTHING, selectorIsInjection \} from '\/server\/lib\/selectorGuard';/,
|
|
'global search must use the shared NoSQL execution guard',
|
|
);
|
|
|
|
const buildSelectorBranch = cards.match(
|
|
/if \(queryParams\.selector\) \{[\s\S]*?\n \} else \{/,
|
|
);
|
|
assert.ok(buildSelectorBranch, 'the client-selector branch must remain identifiable');
|
|
assert.match(
|
|
buildSelectorBranch[0],
|
|
/selectorIsInjection\(queryParams\.selector, 'globalSearch'\)/,
|
|
'an executable client selector must be rejected',
|
|
);
|
|
assert.match(
|
|
buildSelectorBranch[0],
|
|
/\$and: \[[\s\S]*queryParams\.selector[\s\S]*boardId:[\s\S]*Boards\.userBoardIds/,
|
|
'a benign client selector must be conjoined with the caller board scope',
|
|
);
|
|
assert.doesNotMatch(
|
|
buildSelectorBranch[0],
|
|
/selector = queryParams\.selector;/,
|
|
'the publication must never adopt a client selector verbatim',
|
|
);
|
|
|
|
const findCards = cards.match(
|
|
/async function findCards\(sessionId, query, userId\) \{[\s\S]*?ReactiveCache\.getCards\(databaseSelector/,
|
|
);
|
|
assert.ok(findCards, 'the shared initial and pagination query path must exist');
|
|
assert.match(
|
|
findCards[0],
|
|
/selectorIsInjection\([\s\S]*?query\.selector,[\s\S]*?'globalSearch\.pagination'/,
|
|
'stored selectors must be checked again before pagination executes them',
|
|
);
|
|
assert.match(
|
|
findCards[0],
|
|
/\$and: \[storedSelector, boardScope\]/,
|
|
'stored selectors from older releases must be constrained to current access',
|
|
);
|
|
// boardScope is the authorized boards, narrowed to assigned cards on a board
|
|
// where the user is an assigned-only member (2026-10-02). Both arms stay
|
|
// inside authorizedBoardIds.
|
|
assert.match(findCards[0], /\? \{ boardId: \{ \$in: authorizedBoardIds \} \}/);
|
|
assert.match(findCards[0], /\{ boardId: \{ \$in: authorizedBoardIds\.filter\(id => !assignedOnlyBoardIds\.includes\(id\)\) \} \},\n\s*\{ boardId: \{ \$in: assignedOnlyBoardIds \}, assignees: userId \},/);
|
|
assert.ok(
|
|
findCards[0].indexOf('selectorIsInjection(query.selector') <
|
|
findCards[0].indexOf('ReactiveCache.getCards(databaseSelector'),
|
|
'the guard must run before the database query',
|
|
);
|
|
assert.match(
|
|
cards,
|
|
/selector: SessionData\.pickle\(storedSelector\)/,
|
|
'an injected legacy selector must be replaced before it is stored again',
|
|
);
|
|
|
|
console.log('globalSearchSelectorAuthorization: 10 assertions passed');
|