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 !
52 lines
2.9 KiB
JavaScript
52 lines
2.9 KiB
JavaScript
'use strict';
|
|
|
|
// SheetColorBleed (GHSA-crq2-phg8-4xvg, CWE-79, CWE-116): an XLSX member may supply sheetPr/tabColor@rgb, but those
|
|
// bytes may control only a color token, never additional CSS declarations.
|
|
//
|
|
// The original fix canonicalized that color before it entered a server-
|
|
// rendered HTML preview table. The document-preview slideshow that table
|
|
// belonged to has since been replaced: server/lib/documentGif.js now builds
|
|
// only a plain-text search index (indexDocumentText/officeSearchText) and
|
|
// never generates HTML, CSS, or reads style/color data at all - the actual
|
|
// XLSX rendering moved to the restored client-side office-open-xml-viewer
|
|
// (a separate, vendored, MIT-licensed package). So the attack surface this
|
|
// vulnerability lived in - workbook color bytes reaching server-generated
|
|
// CSS - no longer exists on the server at all: there is nothing left to
|
|
// canonicalize because nothing is serialized into CSS here anymore.
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
|
|
const source = fs.readFileSync(path.join(__dirname, '..', 'server', 'lib',
|
|
'documentGif.js'), 'utf8');
|
|
|
|
for (const pattern of [/function safeRgb\(/, /xlsxStyles\(/, /tabColor/i,
|
|
/sheetPr/i, /htmlEscape\(/, /<style/i]) {
|
|
assert.doesNotMatch(source, pattern,
|
|
`documentGif.js must not read/serialize workbook style or color data any more (found ${pattern})`);
|
|
}
|
|
|
|
// Formula source still must not leak into the search index.
|
|
assert.match(source, /xml\.replace\(\/<f\\b\[\\s\\S\]\*\?<\\\/f>\/g, ''\)/,
|
|
'formula source is not copied into the search text');
|
|
|
|
// The client-side viewer is where workbook colors DO reach CSS now. Its tab
|
|
// strip writes the sheet's tabColor into style.cssText, and it accepts only a
|
|
// canonical #RRGGBB (2026-10-02: this test used to read only the server).
|
|
const viewer = fs.readFileSync(path.join(__dirname, '..', 'npm-packages',
|
|
'office-open-xml-viewer', 'dist', 'xlsx-DSU6pV1O.js'), 'utf8');
|
|
const tabStyleAt = viewer.indexOf('tabStyle(e, t) {');
|
|
assert.ok(tabStyleAt > 0, 'the viewer still builds tab styles in tabStyle()');
|
|
const tabStyle = viewer.slice(tabStyleAt, tabStyleAt + 300);
|
|
assert.match(tabStyle, /t = typeof t == "string" && \/\^#\[0-9A-F\]\{6\}\$\/\.test\(t\) \? t\.toUpperCase\(\) : "";/,
|
|
'the tab color is canonicalized before it is put into CSS');
|
|
// Negative: the color gets into the tab's CSS only through tabStyle().
|
|
const tabColorReads = [...viewer.matchAll(/tabColors\[/g)].length;
|
|
assert.ok(tabColorReads >= 1, 'the viewer reads the tab colors');
|
|
for (const m of viewer.matchAll(/tabColors\[[^\]]+\]/g)) {
|
|
const around = viewer.slice(Math.max(0, m.index - 40), m.index);
|
|
assert.match(around, /tabStyle\([^)]*$/, `tab color used outside tabStyle(): ${viewer.slice(m.index - 40, m.index + 30)}`);
|
|
}
|
|
|
|
console.log('SheetColorBleed: the server serializes no workbook color; the viewer canonicalizes tab colors');
|