Real faults: a card's original-position description formatted a promise
because it did not await the history; the attachment swipe distances and
two drag-scroll locals were undeclared globals; a file that cannot be read
during a GridFS upload left the upload open; api.py called exit() instead of
sys.exit(); a rules test redefined a property and a security-log test kept
an unreachable branch. Also 31 missing semicolons, unused imports in the
card details, exporters and attachment API, unused Python imports, and
comments on empty except clauses. The list-sync scanner test cut its source
at the last Meteor.startup, which the new index startup of #6855 had moved.
Thanks to GitHub CodeQL and xet7 !
Since JVN#74210258 (stored XSS) an SVG upload was refused and any stored
SVG was served as a download, so an SVG could not be a card's picture.
Every uploaded SVG is already sanitized on the server before it is
stored - no script, event handler, javascript: URI, foreignObject or
DOCTYPE/ENTITY XML loop (models/lib/sanitizeUploadedFile.js) - so the
refusal goes, for attachments and avatars.
Serving it inline is made safe in one place, server/lib/svgResponse.js,
used by every route that sends file bytes (universalFileServer.js for
attachments, avatars and legacy files, avatarServer.js,
legacyAttachments.js and httpStream.js): the WHOLE file is sanitized
again before it is sent, whatever is stored, and sent as image/svg+xml
under a Content-Security-Policy with default-src 'none' and sandbox, no
script, X-Frame-Options DENY and nosniff, so even opened directly as a
page it runs nothing. A download is sanitized too; a range request gets
the whole file; an SVG over 8 MB stays a sandboxed download. A file whose
active markup is removed on the way out is logged to Admin Panel /
Problems like the stream sanitizer's, and one removed at upload trips
the existing sanitize.dangerous-content canary.
tests/svgServing.test.cjs runs the real sanitizer on a crafted SVG
(script, onload, javascript:, DOCTYPE/ENTITY, foreignObject/iframe) and
checks the body and headers, the download, the oversized case, and that
no file-serving route in server/routes or httpStream.js sends bytes
without the SVG path, and that nothing else sends image/svg+xml;
tests/playwright/specs/svg-attachment.e2e.js uploads one, checks what is
served, that it shows in the card without running anything, and makes
it the cover and the board background.
Thanks to xet7 !
One executable per platform: that platform's published bundle repackaged
as a Node.js single executable application whose ZIP Node 26.11 mounts as
a virtual file system (useVfs + vfsArchive). Only FerretDB is copied out,
once and verified, to wekan-files/bin; native addons load from the VFS.
Everything WeKan writes is in wekan-files beside the executable, which
WRITABLE_PATH points at: attachments, avatars, db, bin, backup, logs,
versions. WeKan now treats a WRITABLE_PATH named wekan-files as the files
root (models/lib/filesRoot.js, shared by every place that derived it).
Started in a terminal it shows a menu: start, stop, status, version info
as Admin Panel / Version shows it, update to the newest release or change
to any other (checksum verified, backed up first, the old executable
kept), backup to wekan-files/backup/YYYY-MM-DD_HH-MM-SS, run at boot
(systemd, launchd, Task Scheduler, cron, Termux:Boot), log, settings.
Every entry is also a command. start runs the start-wekan.sh loop:
recovery, requested restore, FerretDB, recovery page, WeKan, restart.
Meteor's main.js chdir()s into the bundle, which a VFS cannot be, so the
server role keeps a virtual working directory. Node 26.11.1 breaks
fs.writev/readv while any VFS is mounted; they are rebuilt on fs.write
and fs.read.
single-file.yml builds every target in releases/single-file/targets.json
from its verified bundle (Macs on a Mac, to re-sign), starts it where a
runner exists with browser tests on amd64, and attaches what started.
Release All and Release All Missing call it.
Thanks to xet7 !
Alert 564 (regex injection): releases/platform-native-packages.mjs compiled
its command-line platform and arch into a RegExp. The canvas package names
are now compared as strings. The upload naming of attachments and avatars,
the attachment rename popup and tools/mirror-menu.mjs built a RegExp from a
file extension or a name the same way; they use literal suffix and prefix
checks now. tests/noUnescapedDynamicRegExp.test.cjs parses every source file
and fails on a RegExp built from a value that is not escaped, unless the
site is listed with the reason its values are constants.
Alert 563 (incomplete escaping): name.replace('/', '%2F') replaced only the
first slash. registryPackagePath() replaces every one and refuses anything
that is not an npm package name. Seven tests escaped a regex the same
first-only way; 'g++'.replace('+', '\\+') let "- g+" pass a guard. They use
the complete escapeRegExp, and tests/noIncompleteRegExpEscaping.test.cjs
fails on any string-pattern replace that performs an escape.
Alert 562 (ReDoS): the CasaOS reverse-domain id pattern in
tests/platformTemplates.test.cjs let '.' be matched by both groups, so
'0.0.0...!' backtracked exponentially. Each separator now belongs to one
group, and the test runs CodeQL's attack string against it.
Thanks to GitHub CodeQL and xet7 !
The on-disk name of an upload starts with its file id, which the client sends
in opts.meta.fileId. Attachments validated it (UploadPathBleed); avatars - the
same Meteor-Files pipeline - used it verbatim, so an avatar upload with a
fileId like ../../x wrote outside the avatar store, and Avatars.onBeforeUpload
did not require a signed-in user. Both collections now share one rule
(models/lib/uploadFileId.js): an id that does not look like WeKan's own is
replaced with a fresh one and the attempt recorded; avatars need a signed-in
uploader. The negative test fails on any namingFunction in the tree without
the rule.
Thanks to xet7 !
GHSA-w3qg-pf27-g68r: attachments were answered with
Cache-Control: public, max-age=31536000 and no Vary after the board access
check, so a shared cache (CDN, caching proxy) could store a member's copy and
serve it to anyone without credentials for a year, also after the member was
removed from the board. The same header was in setFileHeaders, both ?download=1
branches, both avatar routes, and Meteor-Files' own /cdn/storage route sent its
default public, s-maxage one-year header.
Every file response, its 304 and the thumbnail now send
Cache-Control: private, no-cache and Vary: Cookie, Authorization, X-Auth-Token
through models/lib/fileCacheHeaders.js, for public boards too, because a board
made private later would leave a public copy behind. Both FilesCollections pass
the same cacheControl. The ETag keeps revalidation a bodiless 304.
tests/fileCacheHeaders.test.cjs drives the policy against the shared-cache rules
the report used, checks each route, and fails on any public Cache-Control, a
FilesCollection left on the Meteor-Files default, or an ETag-sending file without
the policy, anywhere in the tree. The thumbnail Playwright spec checks the
headers on every route. Nothing is refused, so there is no Problems key.
Thanks to alham-rizvi and xet7 !
The upload path-traversal guard was logging under the pre-existing
PathBleed key (a different, already-published advisory,
GHSA-4mxf-m8pq-xc9p about avatar versions.path and board export) - it
now has its own UploadPathBleed key, so the two incidents are not
conflated on the public Hall of Fame page or in Admin Panel / Problems.
The two High advisories (missing Avatars.protected, unauthenticated
serveLegacyAvatar) now also log a blocked attempt, under new
authz.avatar-protected/PortraitBleed and
authz.legacy-avatar/RelicAvatarBleed keys, matching the site entries
added at .tools/wekan.fi.
tests/securityRegressionCoverage.test.cjs's inventory and
tests/attachmentAvatarSecurityAdvisories.test.cjs are updated so all four
names (WipeBleed, UploadPathBleed, PortraitBleed, RelicAvatarBleed) are
recognized as GUARDED, matching the published Hall of Fame count.
CRITICAL - Unauthenticated Arbitrary File Write via Path Traversal in
Attachment Upload namingFunction: Attachments overrode ostrio:files'
sanitize() to an identity function and used the client-supplied fileId
verbatim as the on-disk file name, so an anonymous upload with
fileId: "../../../../tmp/pwn" could write attacker-controlled content
anywhere the WeKan process can write. sanitize() is restored to the same
whitelist models/avatars.js already used for the same tokens, and
namingFunction now validates the (sanitized) fileId against the ObjectId
shape WeKan itself generates, regenerating a fresh one otherwise.
CRITICAL - Unauthenticated DDP Methods _FilesCollectionRemove_attachments/
_FilesCollectionRemove_avatars Allow Instance-Wide Deletion: ostrio:files
registers its own remove method, gated only by allowClientCode and never
routed through Attachments.allow/Avatars.allow (those only gate the
ordinary Mongo .remove() call). Attachments had no onBeforeRemove at all
and Avatars' unconditionally returned true, so any anonymous DDP caller
could pass selector {} and wipe every attachment or avatar on the
instance. Both now require this.userId and check every matched file:
attachments need the caller's board-write access, avatars need ownership
or site-admin status.
High - Avatars Collection Lacks `protected` Callback: unlike Attachments,
Avatars never set `protected`, so ostrio:files' own library-native
download route (its _checkAccess defaults to allowing everything when
`protected` is unset) served any avatar to anyone, bypassing
isAuthorizedForAvatar entirely. Avatars.protected now mirrors
Attachments.protected: any authenticated caller, or an anonymous one only
when the avatar's owner is on a public board.
High - serveLegacyAvatar Serves Legacy CollectionFS Avatars Without Any
Authentication: both call sites in server/routes/avatarServer.js streamed
a legacy avatar to any caller who knew its old filerecord id, one of them
(/cfs/files/avatars) with no check at all. Both now require an
authenticated caller (isLegacyAvatarAuthorized) - legacy records carry no
owner/board link that can be safely checked for the public-board
exemption current avatars get, so this is deliberately narrower rather
than reusing that exemption on an unverifiable claim.
Both CRITICAL fixes log a blocked attempt through the shared security log
(new authz.file-remove/WipeBleed catalog key, and the existing
authz.file-path/PathBleed key), so Admin Panel / Problems shows an
attempt was made. tests/attachmentAvatarSecurityAdvisories.test.cjs pins
all four fixes and the negative cases (no dangling anonymous bypass, no
regression to the legitimate admin avatar-delete and public-board
redirect flows).
Now that the grain boots, logs in, lists/opens boards, uploads/downloads attachments,
and migrates an old MongoDB 3 grain end to end, drop the two temporary diagnostics:
- models/attachments.js: revert the Meteor-Files debug flag to false (it was enabled on
Sandstorm to trace the upload 'session expired [408]' issue and was spamming the grain
log with the full FilesCollection dump and every find()).
- server/ferretdbQueryDebug.js: remove the mongodb Collection.find wrapper that logged
FerretDB-rejected selectors (used to find the $elemMatch 'unknown operator: userId'
issue, since fixed in wekan/FerretDB).
Thanks to xet7.
Attachment uploads in the grain fail with HTTP 400 "Can't continue upload, session
expired [408]": the upload start succeeds but the per-fileId session is gone by the
time a chunk arrives (both the in-memory _currentUploads entry and the
__pre_attachments pre-collection doc are missing), which points at the polling
observe (FerretDB has no oplog) firing a spurious removed event and aborting the
upload. The Attachments FilesCollection had debug: false, so nothing about the
upload path is logged. Enable Meteor-Files debug on Sandstorm only (gated on
Meteor.settings.public.sandstorm) so the grain debug log shows the start /
createStream / observer / continueUpload steps and pinpoints where the session is
lost. TEMPORARY: revert to debug: false once the upload is fixed.
Uploading an attachment now creates an addAttachment activity, so card members
and subscribers are notified (consistent with attachment removal) and it appears
in card history. Previously the activity was never created because the store
strategy upload hook was dead code. buildAttachmentAddedActivity unit tested.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>