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 !
55 lines
2.8 KiB
JavaScript
55 lines
2.8 KiB
JavaScript
'use strict';
|
|
|
|
// Guard: HookUrlBleed (2026-10-02). The board publication sent every integration of the
|
|
// board, URL included, to everybody who could read the board - read-only
|
|
// members, and on a public board anonymous visitors. A Slack/Mattermost/Teams
|
|
// incoming-webhook URL carries its secret in the path, so reading a board was
|
|
// enough to post as that board's integration from anywhere.
|
|
//
|
|
// Also the regression guard for WatchBleed (GHSL-2026-036, GitHub Security Lab report of 2026-02-12:
|
|
// the board publication sent integration tokens) and, in its last test, for
|
|
// GlobalBleed (GHSL-2026-037: globalwebhooks published to anybody); the
|
|
// token exclusion of GlobalBleed is pinned by tests/customFieldGlobalBleed.test.cjs.
|
|
// Run: node tests/webhookUrlPublication.test.cjs
|
|
|
|
const { test } = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
|
|
const ROOT = path.join(__dirname, '..');
|
|
const read = file => fs.readFileSync(path.join(ROOT, file), 'utf8');
|
|
|
|
test('only the board\'s admins are published an integration\'s URL', () => {
|
|
const pub = read('server/publications/boards.js');
|
|
const at = pub.indexOf('ReactiveCache.getIntegrations(');
|
|
const child = pub.slice(pub.lastIndexOf('async find(board)', at), pub.indexOf('true,', at));
|
|
assert.match(child, /findWhere\(board\.members \|\| \[\], \{ userId: thisUserId, isActive: true, isAdmin: true \}\)/);
|
|
assert.match(child, /fields: isBoardAdmin \? \{ token: 0 \} : \{ boardId: 1, enabled: 1, activities: 1 \}/);
|
|
});
|
|
|
|
test('the card-opened hook still works from the _id alone (negative)', () => {
|
|
const outgoing = read('server/notifications/outgoing.js');
|
|
assert.match(outgoing, /typeof integration\._id === 'string'\n\s*\? \{ _id: integration\._id, boardId: integration\.boardId \}/);
|
|
// What the client filters on is exactly what a non-admin receives.
|
|
const card = read('client/components/cards/cardDetails.js');
|
|
const query = card.slice(card.indexOf('ReactiveCache.getIntegrations({'), card.indexOf('});', card.indexOf('ReactiveCache.getIntegrations({')));
|
|
for (const field of [...query.matchAll(/^\s*(\w+):/gm)].map(m => m[1])) {
|
|
assert.ok(['boardId', 'enabled', 'activities'].includes(field), field);
|
|
}
|
|
});
|
|
|
|
test('negative: no publication sends integrations with their URL to non-admins', () => {
|
|
const dir = path.join(ROOT, 'server/publications');
|
|
for (const file of fs.readdirSync(dir)) {
|
|
const src = fs.readFileSync(path.join(dir, file), 'utf8');
|
|
if (!/getIntegrations\(|Integrations\.find\(/.test(src)) continue;
|
|
// settings.js publishes the global webhooks to site admins only.
|
|
if (file === 'settings.js') {
|
|
assert.match(src, /if \(!user \|\| !user\.isAdmin\) \{\n\s*return this\.ready\(\);/);
|
|
continue;
|
|
}
|
|
assert.match(src, /isBoardAdmin \? \{ token: 0 \}/, file);
|
|
}
|
|
});
|