Commit Graph
25 Commits
Author SHA1 Message Date
Lauri Ojansivu be6727607c CrossBoardExportBleed: a checklist scope stays on its board, and every export obeys Disable all export and Anonymize export users.
GHSA-8885-xrq4-j47h, reported by ccsimplyspolit, both findings confirmed
in the current code:

1. GET /api/boards/<board>/export?checklistId=<id> (and exportZip)
   selected the scoped checklist and its items by id alone. A checklist
   of another board - a private one too - was streamed with every item
   and its creator, whose profile the anonymization map did not cover.
   Both selectors are now bound to the exported board's cards, and a
   checklist of another board is recorded in Admin Panel / Problems
   (authz.export-checklist-scope).

2. The streaming CSV/TSV export asked neither Disable all export nor
   Anonymize export users. Neither did, it turned out, Excel (board,
   card, all boards), PDF (board and card), the chart exports, the
   calendar feed or the external formats: only the WeKan JSON, ZIP and
   Trello exports did, though the setting promises that "the server
   rejects any export request" and names CSV and Excel.
   - refuseDisabledExport() answers 403 before anything is written, and
     all 13 HTTP export routes call it first; assertExportEnabled() still
     guards the builders. Both record the attempt (authz.export-disabled,
     never blocking the account: a page opened before the switch still
     shows the menus).
   - anonymizeExportIdentities() anonymizes what one exporter writes -
     users, @mentions, requested-by / assigned-by, comments - with the map
     build() uses, board members included. The CSV/TSV stream, Excel,
     PDF, chart exports (forExport: the chart views keep names), the
     calendar feed and every external format call it.

tests/crossBoardExportBleed.test.cjs drives the gate and the anonymizer
and scans the tree: no scoped checklist selected by id alone, no export
route without the gate, no exporter naming people without anonymizing.
All 7 fail on the code before. The new spec
security-cross-board-export.e2e.js replays the reporter's requests and
checks every export route while export is disabled and the CSV and
Kanboard exports while anonymizing; it passes with export-access and
scrum-export-anonymization against a rebuilt bundle.

Thanks to ccsimplyspolit and xet7 !
2026-11-01 14:00:19 +02:00
Lauri Ojansivu b1841b7525 Write the card and board Excel exports as they are drawn, reading each picture only when it is written.
The card Excel export, and the board export drawn in the card layout, read
every picture of the card or board into memory while drawing the sheet and
wrote the whole workbook at the end. They now write through
createWorkbookWriter to the response, and the board export writes each card's
rows out once the card is drawn. With the @wekanteam/exceljs fork's streaming
writer (.tools/exceljs: archiver 8 support and pictures on a streaming sheet)
each picture is a function the writer calls when it reaches it, so one is open
at a time and a picture that cannot be read is written empty rather than
ending the download. The fork is recognised by WorkbookWriter._addDrawing;
until a release with it is installed, these exports take the buffered writer
as before. A failure after the first byte now ends the download instead of
leaving it waiting.

Thanks to markusst1982 and xet7 !
2026-10-09 23:39:18 +03:00
Lauri Ojansivu a904ca8807 Let a card be a subtask of several parent cards.
"A must be done before B and C can start, so A is a subtask of both." A card
now keeps every parent in parentIds, with parentId still the primary one
(parentIds[0]), so everything that reads one parent keeps working and a card
written before this has its one parent. Picking an existing card as a
subtask adds this card as a further parent instead of replacing the one it
had; Card -> More lists the other parents and removes one, and choosing the
primary parent keeps the others. Children are found under any parent - the
subtask list and counter, the parent filter, rule email Details and the
exports - and the loop guard and the board publication walk every parent.
Archiving or deleting a card takes only the subtasks it is the one parent
of; a shared subtask just loses it. Every parent written must be on a board
the writer can see (GHSA-jvv9-498p-hxrg), and board copy and WeKan import
remap all of them. The old single-parent walker is removed.

Thanks to ikomhoog and xet7 !

Fixes #3626,
2026-09-29 17:59:21 +03:00
Lauri Ojansivu 89a65ee7ce Enforce admin-only custom fields across server boundaries
Fix AdminFieldBleed (GHSA-m8gh-2h78-f57x): redact protected values from publications, API responses, method results, History and analytics; constrain value searches and refresh live permissions.

Guard inserts, full-array modifiers, copying and shared definitions at the request write boundary. Require authorized exports and summarize explicit attacks in Admin Panel Problems. Add positive, negative and Chromium regression coverage.

Thanks to Hama1cco and xet7 !
2026-09-28 21:46:56 +03:00
Lauri Ojansivu 0c862047b5 Prevent assigned-only members from exporting unfiltered board data
Share authorization across all nine exporters and retain access only for already scoped Scrum reports. Return HTTP 403 for denied document exports. Document ExportScopeBleed and cover policy, source-wide guards and HTTP behavior.

Thanks to xet7 !
2026-09-27 18:21:58 +03:00
Lauri Ojansivu dce2898382 Attachments: soft delete on the card, restore from the card history, hard delete only with the archived board.
Delete on an attachment used to remove the document and its file at once.
It is now the 'attachments.softDelete' method (History.md section 12): the
document gets deletedAt/deletedBy/deleteBatchId with the same helpers lists
use, the file is kept, and the card's cover is unset if this was it. Every
card-facing read - the opened card's gallery and "Attachments (N)" count,
the minicard paperclip badge, the slideshow, the cover, the board-background
picker, My Attachments, the API list endpoints and the exporters - filters
to live attachments with liveAttachments(); the publications keep sending
the deleted ones so the card history can reach them.

The card history records who deleted it and when, with the filename in the
row. Restore - the table's selection + Restore, or the row's own Restore
button, both through changeHistory.restore and applyAttachmentContent -
clears the mark, so the card, its count and the minicard badge include the
attachment again; the cover is never re-set. An attachment row previews
with the existing attachmentViewer slideshow and downloads with the same
link the gallery draws, and never offers cover or background. Uploads and
renames are recorded through the existing history hooks.

There is no per-attachment hard delete any more: api.attachment.delete,
DELETE /api/attachment/delete/:id and removeBoardBackground soft-delete,
permanentlyDeleteAttachmentFromFilesReport and the Files report's delete
button are gone, Attachments.allow remove and onBeforeRemove refuse every
client remove and log the attempt under Admin Panel / Problems. The one
hard delete is Admin Panel / Problems / Delete enabled, board archived,
board deleted from the archive: boardRemover now removes every attachment
of the board, live and soft-deleted, with its file.

One new i18n key, attachment-soft-delete-pop, replaces the "permanent, no
undo" confirmation text; it is inserted in English into every locale at
the same position for translation.

Thanks to xet7 !
2026-09-11 21:17:33 +03:00
Lauri Ojansivu d5700f5c39 Add a multi-select dropdown custom field type, storing several chosen options.
The existing "Dropdown" custom field type only ever stored one selected
option. Add "dropdownMultiSelect" (models/customFields.js), reusing the
exact same settings.dropdownItems option-list definition mechanism and its
Board Settings editing UI (client/components/sidebar/sidebarCustomFields.js/
.jade) - only the value stored on a card differs: an array of selected item
ids instead of a single one.

On a card, the new type renders as a checkbox list (reusing the app's
existing toggle-checkbox interaction rather than a <select multiple>), and
its value round-trips through Cards.setCustomField() the same way
stringtemplate's own array value already does
(client/components/cards/cardCustomFields.js/.jade).

models/lib/customFieldsWD.js's resolveTrueValue() now resolves a
dropdownMultiSelect's array of ids to the matching item NAMES, joined for
display, so every place that already read a dropdown's trueValue (the
minicard badge, the CSV/PDF/Excel exporters) shows the new type correctly
without further changes there. The CSV/PDF/Excel exporters and csvCreator's
CSV header/definition parsing are updated to resolve
dropdownMultiSelect's array-of-ids the same way the single-select dropdown
already resolves its single id.

Thanks to huma2000 and xet7 !

Closes #4166,
2026-09-10 19:54:38 +03:00
Lauri Ojansivu 4ce5cf6e10 Fix six reported security issues
Authenticate and minimize user publications, escape and throttle user search, enforce board boundaries for position history and exports, and require explicit CAS account linking.

Thanks to Char0n1507, Reload3d, crypto-nidh and xet7 !
2026-08-25 01:04:52 +03:00
Lauri Ojansivu 0885b9a10b Share one card document adapter across PDF and Excel exports. 2026-08-17 04:04:13 +03:00
Lauri Ojansivu bb5275e974 Select requesters and assigners from board members. 2026-08-17 03:05:41 +03:00
Lauri Ojansivu 4b27f4fc45 Name PDF and Excel exports by their localized scope. 2026-08-17 02:34:38 +03:00
Lauri Ojansivu fb52149e94 Align PDF and Excel card attachment layouts.
Place three previews per row with filename-only captions below, retain every attachment in the six-field details table, and draw PDF labels, metadata positions, and checklist progress like the printable Excel card.\n\nThanks to xet7 !
2026-08-17 01:52:34 +03:00
Lauri Ojansivu 7eb0d5ac50 List previewed image attachments only once.
Remove successfully displayed images from the attachment bullet list while retaining non-image files and images whose preview could not be read. Keep filename and size in each preview caption.\n\nThanks to xet7 !
2026-08-17 01:43:26 +03:00
Lauri Ojansivu c796fc6c6b Complete multilingual PDF and Excel exports.
Embed OFL-licensed GNU Unifont fonts in PDF exports, centralize the printable Excel card renderer on the shared card document, and consistently use the saved user language or browser fallback plus the opened card's date format. Document the XLSX font-embedding limitation and cover the locale, font, PDF, and workbook behavior with regression tests.\n\nThanks to xet7 !
2026-08-17 00:50:10 +03:00
Lauri Ojansivu 50edf13a89 Only the fields that have data are added, decided once for both formats.
An export should not carry a Comments heading with nothing under it, or a Custom
fields section for a card that has none, or a row of dashes where a description
would be.

"Empty" is a JUDGEMENT, not a length check - a checklist with no items yet is
empty, a checklist whose items are all unticked is not; a custom field with a
definition and no value is not data, and most cards carry several of those - so
it is answered in ONE function, models/lib/cardDocument.js's hasSectionData, and
both exporters ask it. Two exporters answering it separately is how a PDF and a
spreadsheet of the same card come to contain different sections, which is the
whole reason the document model exists.

The document itself now contains only the sections that have something in them,
and the Excel and PDF exporters call the same predicate beside their existing
`?fields=` check - which stays, because it is a different question: the
selection says what the reader ASKED for, the data says what there is to give
them, and a section needs both.

One thing worth naming, because it nearly shipped: an edit that added the
guards threw part-way through, so the file kept a call to hasSectionData and
lost the import that defines it - which no test would have caught, since none of
them can import a Meteor path, and the first symptom would have been a card that
would not export at all. The import is there, and every guard's local was
checked against what cardBlockLines actually destructures from its data.

Thanks to xet7 !
2026-08-16 23:30:13 +03:00
Lauri Ojansivu c1b68efbd3 Step 2: every text in an Excel card export renders its markdown.
The description went first. A description that renders and a comment that does
not is worse than neither, because the file then disagrees with itself about
what markdown is - so the comments, the checklist items and the custom-field
values go through the same shared parser now.

Each keeps what is the EXPORT's own mark rather than the author's: a comment
still has its author's name in front of it, in bold, and a checklist item still
has its `[x]` or `[ ]` box - written as their own runs so the rendered text
follows them instead of being pasted into a string. A finished item's strike
carries onto every run of its title, or half of a struck-out line would look
live.

One fault found while doing it: splitRow estimates a row's height from the
length of its value, and a rich-text value is an OBJECT whose `.length` is
undefined. Measuring the value itself would give every formatted comment the
minimum height and clip it, so the runs are added up instead.

A value with no markdown in it is still written as a plain string - the same
cell, byte for byte, as before this change - which is what keeps the step
verifiable: only cards that actually contain markdown produce a different file.

Thanks to Heart1010 and xet7 !
2026-08-16 23:17:15 +03:00
Lauri Ojansivu b4e9d1f8d1 Exports render markdown the way WeKan renders it, from one shared parser.
A card's description, its comments and its checklist items are markdown, and
WeKan draws them as markdown everywhere it shows them. The exports did not: the
PDF flattened `**bold**` to the word with its asterisks still attached, and
Excel wrote the source text into a cell. A card that reads well on screen
exported as something nobody would write on purpose - #6586, "markdown is not
formatted - this doesn't make sense in a pdf file, does it?"

models/lib/exportMarkdown.js parses it with THE SAME markdown-it options the
reader's renderer uses - html, linkify, typographer, breaks - so the export and
the screen agree about what is emphasis, what is a list and where a paragraph
ends. It answers in a shape neither exporter is: blocks carrying runs of styled
text, `{ text, bold, italic, code, strike, link }`. Excel turns runs into an
ExcelJS richText array; the PDF will pick one of its four Courier faces. Neither
has to know markdown, and a fix to how a list nests reaches both at once - which
is the whole reason there is one module rather than two.

HTML in a card is kept as TEXT, deliberately. An export is a document, and a
card containing a script tag should put those characters in the file rather than
have anything act on them.

Wired into the Excel card export's description first, where a single unstyled
run is still written as a plain string - so a card with no markdown in it
produces exactly the file it did before.

AND THE PLAN FOR THE REST IS WRITTEN DOWN, because the request is one rule:
the same functions, layouts and templates for every PDF and Excel export, with
no duplicated code. docs/Features/ImportExport/One-Card-Layout.md says what that
means and in what order it lands.

Two of the four quarters are already true, and by the same method - one
renderer, called by every scope. Excel draws the card layout at every scope
(ExporterExcelBoard renders each card through ExporterExcelCard.renderCardBlock),
and the PDF already shares one block across scopes (ExporterBoardPDF and
ExporterCardPDF both render through PDFExporterBase.cardBlockLines). What is
missing is that the PDF's block is not that LAYOUT: monospaced lines, no
sections, no label columns, no boxes, no images.

So the next step is not "make the PDF look like the Excel code". It is a card
DOCUMENT - one description of the layout, built once from a card, rendered twice
- with the Excel renderer moved onto it first, unchanged output being what makes
that step verifiable, and the PDF renderer and its images following.

Thanks to Heart1010 and xet7 !
2026-08-16 23:05:44 +03:00
Lauri Ojansivu bd009cf601 Export a board, a swimlane or a list, in the card export's own layout,
with a popup for what to include.

#1173 "Add Feature: Print Board with Params" has been open since 2017, and
two things were missing.

There was no CHOICE of what to print. The board's Excel and PDF exports took
everything they knew how to render and nothing else, while the card export
already had a popup with a checkbox per section. And they did not LOOK like
the card export: the board's Excel export was a spreadsheet table, one row
per card and eighteen columns, which is a data dump rather than a printed
board.

Both now render a board as its own header followed by every card as the CARD
export's block, drawn by the card export's own code - cardBlockLines() for
the PDF, ExporterExcelCard.renderCardBlock() for the Excel one. A card looks
the same whether it was exported alone or inside its board, and the two
cannot drift into two layouts again. Each card starts on its own page in the
Excel export, because a printed board is read a card at a time.

The swimlane and list menus offer the same export, which is the board export
with one query parameter saying which cards are in scope. They sit beside
"Copy link" rather than under the permission checks, because exporting is
reading, and the file is named for what was exported - a PDF titled with the
board that holds one list is a file nobody can place afterwards.

The selection is one popup body used by all three menus, and one list:
models/lib/exportFields.js, imported by the exporters and by every popup.
The card export's list used to live twice, in the server and in
cardDetails.js under a comment reading "Must match ALL_FIELDS ..." - which
is a comment, not a mechanism, and a section added on one side is either a
checkbox that does nothing or a section nobody can turn off. The same
?fields= now gates the same sections in both formats; the card popup's
checkboxes used to say "fields to include in Excel export" and did nothing
to the PDF.

A card block cannot be streamed - it merges cells, styles them and returns
to earlier rows - and models/server/ExporterExcel.js streams on purpose,
after the in-memory version ate gigabytes on boards with thousands of cards.
That exporter is still there and still reachable: unticking "Card details"
asks for it. A checkbox, not a silent fallback.

A board's per-card data is read once per collection and grouped by card. The
card export's own per-card queries would be fifteen hundred round trips on a
board of three hundred cards.

tests/boardExportScope.test.cjs pins the shared block, the shared list, the
gating, the three menus and the streaming exporter still being reachable.
Two guards moved rather than being deleted: they pinned the board PDF
building its own labels and the server's own copy of the field list, which
is the behaviour that deliberately changed.

Thanks to xet7 !

Fixes #1173,
2026-08-14 00:38:55 +03:00
Lauri Ojansivu 698e980e27 Card PDF and Excel exports say the same thing, in the reader's language,
format and time zone.

#6586 was reopened for what the first fix left, and every point of it was a
symptom of one thing: the PDF export of a card had grown separately from the
Excel export of the same card.

"Assignee, Labels, due,... these titels should be in the user set language" -
the labels were hard-coded English, and not even consistent with each other:
the card export wrote "Due: " while the board export wrote "due" with no
colon. Both exports now build every label from the same i18n keys, in the
language the request carries, through one field() helper that writes every
"Label: value" - so the two cannot drift apart again. Every key carries its
English text as the fallback, so a missing translation shows the word and
never the key.

"I think all those other things we set in a card should be also present" -
both exports now carry title, labels, creator, assignees, members, board,
swimlane, list, card number, requested by, assigned by, the six dates, spent
time, description, custom fields, checklists, subtasks, comments,
attachments, voting and Planning Poker, in that order. Custom fields, voting
and poker are new on BOTH sides; they are appended to ALL_FIELDS rather than
inserted, so a saved ?fields= link still asks for what it always asked for,
and they are checkboxes in the export popup like the rest.

"the time is not in the user set timezone (-2h wrong for Europe/Berlin)" -
it was worse than -2h: the PDF printed UTC and the Excel export printed
whatever zone the server was started in. Dates are stored in UTC and a
profile carries no zone, so the export links now send the browser's IANA
zone and the date format the OPENED CARD is showing - which for a logged-out
reader lives in localStorage, where no server-side lookup reaches it. Both
exports format through formatDateByUserPreference, which gained an optional
zone; without one it still renders in the process zone, which is what every
client-side caller wants. A server-built export given no zone renders UTC
and says UTC. Verified: 12:00Z prints 14:00 for Europe/Berlin, 00:00 on the
15th for Pacific/Auckland, and an unknown zone falls back instead of
failing.

"would it make sense to support markdown formated text in description" - a
description is now cut into runs and drawn in the four base-14 Courier
faces, so **bold**, *italic* and ***both*** are bold, italic and both.
Consecutive Tj operators continue at the current text position, so a font
switch needs no glyph measuring. Strikethrough and inline code keep their
words and lose their markers - a Type1 base-14 font has no strike and there
is no fifth face for code - and an underscore inside a word stays an
underscore.

tests/cardExportParity.test.cjs pins the shared field list, keys, formatter
and request params; tests/pdfExport.test.cjs gains the runs, the wrapping
and the four declared faces. Two of its guards moved rather than being
deleted: they pinned the hard-coded English "Labels: " and "due", which is
the behaviour that deliberately changed, and they now pin that both come
from the same keys.

Thanks to Heart1010 and xet7 !

Fixes #6586,
2026-08-14 00:09:31 +03:00
Lauri Ojansivu 5269d0ba5c PassBleed: the Excel card export authorised one board and read a card from another.
GHSA-6p5m-f9p2-wqm5, CWE-639, CVSS 6.5.

    GET /api/boards/:boardId/lists/:listId/cards/:cardId/exportExcel

checked whether the caller could see the board in :boardId, then resolved the card
by :cardId alone. Nothing confirmed the card was on that board, so the two
identifiers came apart: one decided the authorisation, the other decided the data.
canExport() is given this._boardId and never sees this._cardId, so it can answer
"may this user see that board?" and cannot answer "may this user see that card?".

The pass is self-service. POST /api/boards takes `permission` straight from the
request body, so any authenticated user could mint their own PUBLIC board, name it
as :boardId, and pass the id of a card in somebody else's private board as
:cardId. :listId was never used in a query at all and could be any string.

What came back was the card: title, full description, members and assignees, every
comment with its author, checklists and checklist items, subtask titles,
attachment metadata - and, because image attachments are read through
getReadStream() and embedded with workbook.addImage, the attachment BYTES, which
is functionally an arbitrary private attachment download. One board could be
reused while :cardId was substituted, making it a scriptable bulk-collection
primitive rather than a single disclosure, and the REST API is on by default in
the shipped Docker configuration.

THE FIX WAS ALREADY IN THE CODEBASE, ONE FILE AWAY. The structurally identical
PDF route has always resolved getCard({ _id, boardId, listId }) and 404s a
cross-board id (ExporterCardPDF._getCardData). That control is what shows the
Excel exporter's omission was a defect rather than a decision, and it is exactly
what the Excel exporter does now.

Constraining the QUERY matters more than adding a check after it. The exporter
fans out on the same card id - checklists, checklist items, subtasks, comments,
attachments - and none of those carry a board constraint of their own. A card that
cannot resolve outside the authorised board makes every one of them safe by
construction rather than by a second guard that could be missed the same way.

The route binds the two identifiers as well, before either branch builds. That is
deliberate duplication: it is cheapest to state where both identifiers arrive
together, and it covers the public-board branch, which skips authentication
entirely and would otherwise rely on the exporter alone. A card that is not on the
named board is a 404 rather than a 403, so the difference does not tell an
unauthorised caller whether a given card id exists.

Audited the reporter's systemic point: the only two single-card export routes are
this one and the PDF one, and the attachment handlers already check
card.boardId !== boardId. tests/exportExcelCardContainment.test.cjs pins the
constrained lookup in both places, that the route checks before EITHER branch
builds, the 404, and that the PDF control it copies is still there.

Thanks to TWPaMWang and xet7 !
2026-08-11 19:02:58 +03:00
khuongsatou's projects 4763c94604 Add Apple Glass Pastel board theme
Register appleglasspastel as a fixed special theme, wire its accent and exporter colour, add glass/pastel board surfaces, and guard the picker/docs/runtime preview coverage.
2026-08-10 21:51:21 +07:00
Lauri Ojansivu f0bce67a3b More Import Export and Rules features.
Thanks to xet7 and Claude !
2026-06-15 04:07:33 +03:00
Lauri Ojansivu 5c5ed102ca Export Card to Excel. Part 3. Also, fixed uploading attachments.
Thanks to xet7 !

Fixes #5324
2026-03-25 01:37:42 +02:00
Harry Adel 63ce45c538 Split shared models from Meteor 3 server runtime 2026-03-24 01:50:39 +02:00
Lauri Ojansivu be5bdbe314 Export Card to Excel and related fixes. Part 1.
Thanks to xet7 !

Fixes #5324
2026-03-21 20:57:07 +02:00