- server/lib/attachmentApiAccess.js: the size limits and the board write check
that the attachment Meteor methods (server/attachmentApi.js) and REST routes
(server/routes/attachmentApi.js) each defined, identically - seven
functions. tests/assignedbleed reads the write check there and fails if
either API defines its own again.
- server/lib/contentDisposition.js: the Content-Disposition filename
functions of server/routes/universalFileServer.js and legacyAttachments.js.
- models/lib/fileStoreStrategy.js: the GridFS, filesystem and cloud strategies
had the same interceptDownload. The base class now has it, and still fails
closed: a strategy whose getReadStream() gives nothing - the base one gives
nothing - answers 404 and never hands the file to Meteor-Files unfiltered.
tests/attachmentServeFailsClosed holds any override to the same rules.
- models/lib/uploadFileId.js: uploadNameParts() reads the id and name of an
upload for both Attachments' and Avatars' namingFunction, which each had
the same 25 lines. tests/uploadFileId, which the module's comment named but
did not exist, covers it and safeUploadFileId.
Thanks to 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 !