Commit Graph
110 Commits
Author SHA1 Message Date
Lauri Ojansivu ba3d94390b ListLockBulkBleed: bulk and server-side card writes ask the list's role exception.
GHSA-83w9-74mx-7v83. A board admin can refuse a role write access in one
list (#4527, roleExceptions). REST DELETE /api/boards/:boardId/cards/bulk
and POST /api/boards/:boardId/cards/labels take their cards from the
body, so no URL names a list, and asked only for board write access; the
methods archiveSelectedCards, copyCard and createLinkedCard write from
server code, past the Cards allow/deny rules. A normal member the list
refused could delete, relabel and archive its cards and copy or link new
cards into it.

- The bulk routes read every card and ask each list before the first
  write (assertCardListsNotRefused): any refusal is a 403 and nothing
  changes, recorded in Admin Panel / Problems as ListLockBulkBleed
  (authz.list-locked-bulk, medium). Each removal and relabel is keyed on
  the list that was checked.
- The methods refuse with not-authorized (assertListsWritable), not
  recorded: Copy Card and Multi-Selection reach them in ordinary use.
- The same shape, fixed with the same check: createBoardFromCard,
  addSubtaskCard, createCardWithDueDate (which also did not check that
  the list is on the board), the iCalendar import over DDP and REST,
  sending and receiving board email, vcsCreateIssue, moveBoardObjects,
  History's undo/redo/Restore, position history undo/redo of a card,
  renameAttachment, the scoped import and a card's rule button.
  Dependency lines keep their own board-wide rule.

tests/listLockBulkBleed.test.cjs runs the gate on the reporter's board
and pins every path; tests/playwright/specs/list-lock-bulk.e2e.js replays
the proof of concept. Older guards that pinned the previous shape are
updated with the reason.

Thanks to immanuwell and xet7 !
2026-11-18 22:25:34 +02:00
Lauri Ojansivu 11bed26788 Companion repositories are found in .tools/w, .tools/xet7 and .tools/Secretchronicles.
The repositories under .tools/ are now grouped by their GitHub owner:
github.com/wekan/* in .tools/w/, github.com/xet7/* in .tools/xet7/ and
github.com/Secretchronicles/* in .tools/Secretchronicles/. build.sh,
build.bat, the release and debug scripts, the tests and the docs looked
for .tools/FerretDB, .tools/wekan.fi, .tools/charts, .tools/node-patches,
.tools/mongo-tools-patches and .tools/TSC, and now use the new places.

ensure_tool_repo takes the owner from the clone URL through a new
tool_repo_dir, so a missing companion repository is cloned into the same
place the scripts read it from. tests/toolsDirectoryRepos.test.cjs runs the
mapping and checks that nothing lands flat in .tools/ any more.

Finding the website checkout again let securityRegressionCoverage compare
the Hall of Fame, which it had been skipping: CreateBleed is published and
is now in the inventory with its unit and UI tests. The exceljs fork test
reads npm-packages/exceljs, the copy WeKan builds with, instead of a clone
under .tools that is not part of the build.

Thanks to xet7 !
2026-11-07 23:32:43 +02:00
Lauri Ojansivu 582a22c291 Fix GitHub code scanning code-quality findings.
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 !
2026-11-02 14:15:02 +02:00
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 0d6d481fcb ImportPlacementBleed: an import into a board is placed only beside that board's own list, swimlane or card.
The scoped importer, reached by POST /api/import/zip and the importScoped
method, authorized the import on boardId alone. The listId and swimlaneId
beside it were written onto the new cards as given, and a cardId was looked
up with no board filter, so a writer of board A could create cards on A
whose list and swimlane were board B's, and could probe whether a card id
existed on a board they cannot see.

Before anything is written, the list, swimlane and card are now looked up
together with the board's id; an id of another board is refused (400 over
REST, error-import-placement from the method), with the same answer for a
foreign card and a missing one. Cards are placed only by what was found on
the board. A refusal is recorded in Admin Panel / Problems as
ImportPlacementBleed (authz.import-placement), without blocking the account.

Tests: the decision with the reporter's ids, the check before every write,
a negative scan for a target id written or looked up without the board, and
a browser test of the reporter's attack by both routes, which fails on the
previous code.

Thanks to Zachariah Mithani (AploSec) and xet7 !
2026-10-29 20:27:14 +02:00
Lauri Ojansivu 06b7ce994a Backup status: every run recorded, failures and overdue backups shown, old local backups pruned - in Admin Panel too.
The result of an Admin Panel backup lived only in the memory of the server
process that ran it. After a restart, or on another pod of a multi-pod
deployment, the Backup pane said "idle", so nobody could see whether last
night's backup had worked. There was no history, no warning when a scheduled
backup failed or did not run, and local backups were never cleaned up.

- Every run, scheduled or "Backup now", is recorded in backupRuns: start and
  end, who or the schedule, scope, storage, status, size, duration and error.
  Records are kept 400 days. A run still "running" after 24 hours counts as
  failed, and a scheduled run skipped for another backup is recorded as failed.
- Admin Panel / Problems / Backup shows the last success (overdue when its
  period has passed), the last failure with its error, the next run and the
  last 30 runs. The same status is above the schedule in Attachments / Backup.
- Problems / Summary lists "Backup failed" and "Backup overdue". /metrics adds
  wekan_backup_last_success_timestamp_seconds,
  wekan_backup_last_run_timestamp_seconds, wekan_backup_last_run_success and
  wekan_backup_overdue for alerting.
- BACKUP_KEEP_DAYS: after a successful backup, local backups of the same scope
  older than N days are deleted. The newest is always kept, and only a
  directory inside the backup root holding a backup.zip is removed.

From the patch by Raymond-Voogt, and in Admin Panel as well:
- BACKUP_KEEP_DAYS is the catalog's backup section
  (models/lib/authConfigCatalog.js), overridable beside the schedule in
  Admin Panel / Attachments / Backup and resolved through authEnv at every
  backup.
- It is listed on every platform: the compose files, start-wekan.sh and .bat,
  the snap config and help, and the Dockerfile, which the patch's version
  had missed. Its platform hunks, written before #6789, were re-applied by
  hand.

tests/backupRuns.test.cjs (21): the run records, overdue and pruning against a
real directory, and the Admin Panel override, including that nothing reads the
variable around it. tests/authConfigCatalog.test.cjs checks every platform.
admin-attachment-retention.e2e.js checks the Backup pane shows the field.

Thanks to Raymond-Voogt and xet7 !

Fixes #6790.
2026-10-20 13:30:00 +03:00
Michael Nutt 3df146c164 Defer ZIP and Excel initialization until first use
Load archive libraries only when an import, export or restore needs them.
Keep lightweight timing enabled and make detailed Meteor profiling opt-in.
Include first-use regression checks and production measurements.
2026-10-11 23:30:56 -04: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 52b86ef753 Read a PDF export's pictures one at a time as they are drawn, and write it to disk, not memory.
The card and board PDF exports read every picture of the card or board into
memory before making the document, then built the whole PDF in memory too.
Each picture is now a loader: the Unicode PDF writer reads it when it draws
its row and hands it to PDFKit, which embeds it and lets the bytes go, so
one picture is in memory at a time. The document is written to a temporary
file as it is made and sent from there with its length, so it is not held
in memory either, and the base-font fallback still takes over when the
Unicode PDF fails - reading the pictures only then. Removed from TODO Later;
the Excel half stays there with what blocks it.

Thanks to markusst1982 and xet7 !
2026-10-09 23:13:44 +03:00
Lauri Ojansivu 73db241bd4 Choose who an import's people become, for every import, and stream imported attachments.
Every import page now asks once what the people named in the file become
(models/lib/importMembersMode.js): existing users chosen in the map-members
step, placeholder users that keep the original username and name and cannot
log in, to be mapped to real users later, or all the person importing. All
five creators read the same mapping. The generalized importer, which used to
drop people nobody mapped, now makes placeholders for them, as Trello and
WeKan imports do, and offers its people for mapping by reading the file with
the same parser (importBoard with previewPeople, which creates nothing).
Import many boards offers placeholders or the importer. The REST import, the
WeKan .zip route and the Trello route take the mode too.

A WeKan .zip imported as a new board no longer puts its attachment files
inline in memory within a 512 MB budget: the full-board importer streams each
from the archive into storage, as the import into an existing board does.
Both, and the Trello importer when given a stream, go through one helper
(server/lib/importAttachmentStream.js) that holds every imported attachment
to the Admin Panel's upload limit and to none when none is set, skipping a
file whose stated size is over it and stopping one that grows past it.

The import page instructions name Jira's current search (GET
/rest/api/3/search/jql with fields=*all, paged by nextPageToken), Todoist's
Manage data > Export as CSV and Planner's Export as Excel.

Thanks to xet7 !
2026-10-09 12:20:36 +03:00
Lauri Ojansivu 7858d84e12 Import and export many boards at once for every format, and document each format in its own directory.
Import many boards: on the import page of every source, several export
files, or one .zip holding them, each become their own board through the
same path a single import of that file takes, and the page lists what each
file became (models/lib/importManyFiles.js). A .zip that is itself one
export (Vikunja, Notion, Plane, WeKan with attachments) stays one board.
One board per project: for the generalized importer, each swimlane the
import would make - a project, folder or list of the tool - becomes its own
board (models/lib/importSplit.js), so an export of a whole app imports as
many boards, as a Trello .zip does. Kanri's all-data export now reads every
board, not only the first, so it splits into one board per Kanri board.

Export all boards: All Boards sidebar, or Multi-Selection for the selected
boards, downloads every board the user may export in one format, each
checked as its own export is. Excel is one workbook with a sheet per board,
named after the board; every other format is a .zip with one file per board
(server/routes/exportAllBoards.js). The per-format bytes are made in one
place, server/lib/renderExternalExport.js, for the board route and this.

A WeKan .zip export imports as a new board from All Boards, unpacked on the
server with its attachments (it was refused in the browser). api.py gains
importboardsfrom and exportallboards, sends every source in the shape the
import page sends, and fetches Excel, PDF, CSV and TSV exports from their
own routes and writes them as bytes.

Fixed while documenting: a Trello Butler rule's list name kept its case,
so the rule fires; the HTML export fetches the board JSON by URL instead of
a link the export popup no longer has; Tasks.org exports time spent;
Nextcloud Deck's done flag marks the due date done.

docs/Features/ImportExport has a directory per format with the steps to
import and export it, one board and many, and its details, moved from
Format-Coverage.md, which is now the index and the shared contract.
tests/importExportDocsCoverage.test.cjs fails when a format has no page.

Thanks to xet7 !
2026-10-09 10:33:37 +03:00
Lauri Ojansivu a4b524a5fc Compare the /metrics access token in constant time, and refuse an empty one.
METRICS_ACCESS_TOKEN set but empty let ?access_token= through, and the loose
early-exit comparison leaked how much of a guess was right through timing.

Thanks to xet7 !
2026-10-02 11:38:24 +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 15ff19d2a8 Export scoped daily Scrum observations to Excel and PDF
Share the bounded history reader with report downloads. Preserve exact UTC capture times, estimate policies, unknown counts and partial or truncated result notices. Verify real workbooks and extracted PDF text through the application.

Thanks to xet7 !
2026-09-27 22:27:51 +03:00
Lauri Ojansivu 8e4cf5f76f Retain Scrum report context and commitment totals in exports
Export estimate source, custom field, completion policy and completed original commitments. Render wide Scrum PDFs as wrapped labelled values to avoid clipped columns.

Thanks to xet7 !
2026-09-27 20:13:24 +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 83eac10211 Add Scrum sprint planning, optional metadata and snapshot reports
Reuse board permissions, card estimates and chart exports for Product Backlog, Sprints, Sprint Report and Velocity views. Add revision-checked sprint lifecycle, recoverable rollover, release/event creation and independently hidden metadata controls. Explicitly label assigned-only reports as partial.

Verified 12 focused Node checks, a real Meteor/Mongo lifecycle regression and three Chromium scenarios including settings visibility, denial paths and actual Excel/PDF files. History integration, full transfer mappings and further report/editor work remain tracked in the Scrum design.

Thanks to xet7 !
2026-09-27 17:33:38 +03:00
Lauri Ojansivu 0b411b5476 Add flow analytics charts and reversible dependency history
Reuse board dates, activities, estimates, dependencies and universal History for Aging WIP, Blocker Analysis, Monte Carlo forecasts, XmR and size versus cycle time. Keep Chart.js lazy loaded and share parameterized PDF/Excel exports. Record dependency edits in History with undo/redo and board-boundary validation.

Validation: 21 focused Node suites and 8 Chromium tests pass, including every chart download and dependency undo/redo. Report labels reuse native locale vocabulary and formula notation; compact explanatory wording outside English/Finnish has low confidence and welcomes review.

Thanks to sojournerc and xet7 !

Fixes #1476,
2026-09-26 22:40:39 +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 278db0ada3 Write dates as real date cells in every Excel export.
Reported directly, with a LibreOffice screenshot: the Frappe Gantt view's
Excel export showed Start/Due/End as ISO text ("2026-09-23T09:00:00.000Z").
ExporterChartExcel wrote cell.toISOString() into the cell. A date is now a
real date cell with a date number format (yyyy-mm-dd hh:mm), so the
spreadsheet shows it in its own date format, sorts it as a date and can do
arithmetic on it; the "-" placeholder for an unset date stays text. Every
chart export (Gantt, Time, the report charts) shares this exporter.

The follow-up ask - every other Excel export too:
- The board and card Excel exports draw the shared card document
  (models/lib/cardDocument.js), whose meta pairs were pre-formatted text
  (fmtDate), so Created/Received/Start/Due/End/Last activity were text
  there as well. A date pair now carries the raw Date as a third element
  ([label, text, Date]); renderCardDocumentExcel writes that as a date cell
  and the PDF keeps printing the text. ExporterExcelBoard's own
  Created/Modified lines get the same treatment.
- The legacy whole-board Excel export (ExporterExcel.js) already wrote Date
  values into numFmt columns; nothing to change, pinned as such.

tests/chartExcelDateCells.test.cjs drives the chart row-writing branch
against a stand-in worksheet and pins the other exporters' shapes;
tests/pdfExport.test.cjs updated for add()'s third argument.

Thanks to xet7 !
2026-09-11 10:49:27 +03:00
Lauri Ojansivu e487f8d913 Keep each chart PDF export row on one line, in fixed columns.
Reported directly: in the Frappe Gantt view's PDF export a row's text was
not on one line. ExporterChartPDF wrote every header and data row as ONE
text line - "title  |  start  |  due  |  end" - with no width limit, so a
long card title pushed the dates off the page edge in the Unicode PDF and
past the line in the base-font fallback, and nothing lined up from row to
row.

New models/lib/pdfDocument.js tableRow(): a row with fixed column widths
(the name column twice the others), a cell that does not fit clipped with
an ellipsis rather than wrapped, so a row is always exactly one line.
buildUnicodePdf draws it as measured cells (PDFKit width + ellipsis); the
base-font fallback gets the same row as padded monospaced runs within the
text width. ExporterChartPDF uses it for the header (grey bar, bold) and
every row of every chart export - Gantt, Time and the report charts share
this exporter.

tests/chartPdfTableRows.test.cjs pins the one-line/aligned-columns/clipping
behaviour and that the exporter no longer joins rows into unbounded text.

Thanks to xet7 !
2026-09-11 10:42:40 +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 3abc1078c2 Implement the 10 board report charts and Gantt/chart PDF+Excel export.
The Board View menu's Dashboard, Burndown, Burnup, Cumulative Flow, Control
Chart, Lead/Cycle Time, Flow Efficiency, Throughput Histogram and WIP Run
entries opened a plain "not implemented yet" page. Each now computes and
renders its chart from this board's own Cards/Lists/Activities, per
docs/Features/Reports/charts.tsv's calculation descriptions - plain HTML/CSS
bars and a data table, no new charting dependency.

Every chart page, and the Gantt view, gets "Export to PDF" / "Export to
Excel" buttons that reuse the existing card/board export renderers
(pdfDocument's line/bar builder, createWorkbook's Excel styling) through the
same public-board / authToken / logged-in-user auth gate every other export
route already uses.

Completion date is card.endAt || card.archivedAt (WeKan has no dedicated
"Done" list flag); WIP Run's limit line only draws when a list's own WIP
limit is enabled (no invented board-level schema); Flow Efficiency's
"active" time is card.spentTime (WeKan does not track per-list queue time).
Each deviation from charts.tsv is documented where the calculation is.

models/lib/chartCalculations.js (20 tests), models/lib/chartExportRows.js
(8 tests) and the export routes' auth shape (10 tests) are covered by
tests/chartCalculations.test.cjs, tests/chartExportRows.test.cjs and
tests/chartExportRoutesAuth.test.cjs; tests/boardViewMenu.test.cjs is
updated for the now-real views. Not verified here: actual Blaze rendering
and generated PDF/XLSX bytes (no browser/Meteor runtime in this
environment) - matched syntactically against statsView/timeView and the
existing exporters.
2026-09-10 15:04:05 +03:00
Lauri Ojansivu f383fe9b3a Fix board export to .zip (with attachments) answering a bare 500 error.
models/server/ExporterZip.js still called archiver the v7 way -
require('archiver')('zip', {...}). archiver@8 is ESM-only and exports
classes with no callable default, so that call threw synchronously before
exportZip's route wrote any response header, and safeRoute answered a bare
500 with no detail - every "export board -> .zip" request, for every
board. server/methods/backup.js hit the identical break earlier and
already fixed it with `new ZipArchive({...})`; this call site was missed.
Fixed the same way, with a regression test that also scans the tree for
the same dead API shape.

Thanks to the reporter and xet7 !
2026-09-10 03:13:37 +03:00
Lauri Ojansivu 828fc2d718 Revert Legacy HTML4 browser interface and parity changes
Remove the progressive HTML4/Legacy Omi middleware, cookieless sessions, page controllers, assets, parity refactors, design documents and associated tests. Restore the standard Meteor interface and operations from before the HTML4 work began.

Preserve intervening translations, backup screenshots, session upgrades, cryptographic test identifiers, local image storage, document previews and lazy browser loading. Extract the GIF utilities still required by image features into imageGif.

Validate the Node suites and add standard-interface and GIF regressions. Two existing failures remain in docsLinksResolve and ruleDetailsLocalization; browser regressions are registered but require a running server.

Thanks to xet7 !
2026-09-07 17:03:59 +03:00
Lauri Ojansivu c8dbb528ec Add accessible checklist import and export 2026-09-06 22:08:40 +03:00
Lauri Ojansivu 7c95f4c000 Complete checklist-scoped import and export 2026-09-06 21:46:37 +03:00
Lauri Ojansivu 034d3b9208 Add Legacy HTML4 WeKan ZIP imports
Read whole-board and scoped archives through one bounded path-safe service, stream attachment bytes through the standard Default Storage hook, and preserve stable attachment ids in ZIP exports. Add the signed HTML4 ZIP upload, fix Meteor-Files 3 Promise handling, and verify valid and traversing archives in a cookieless browser.
2026-09-06 20:11:20 +03:00
Lauri Ojansivu 829d2a6c74 Enforce Amiga-safe filenames on every read 2026-09-06 02:28:46 +03:00
Lauri Ojansivu ec26abdc91 Bundle portable PDFKit in every release target 2026-08-30 22:40:33 +03:00
Lauri Ojansivu 6c39c6ad32 Keep Windows PDF and Snap release builds portable 2026-08-30 21:31:49 +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 57c806705c Order detailed exports by board hierarchy. 2026-08-17 02:38:04 +03:00
Lauri Ojansivu 4b27f4fc45 Name PDF and Excel exports by their localized scope. 2026-08-17 02:34:38 +03:00
Lauri Ojansivu ef66347f07 Place six Excel attachment previews per row.
Use one worksheet column per preview, put each filename in the cell directly below, and begin a new image and filename row after every six attachments.\n\nThanks to xet7 !
2026-08-17 02:07:39 +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 4deff691eb Start PDFKit with the embedded Unicode font.
Avoid PDFKit's startup lookup for Helvetica.afm, whose package-relative path is unavailable after Meteor production bundling, so Unicode PDF export no longer falls back to the base-font writer.\n\nThanks to xet7 !
2026-08-17 01:20:38 +03:00
Lauri Ojansivu 9ff542b9b1 Wrap PDF metadata and arrange image previews in rows.
Keep complete date and time values visible, place up to three attachment previews on one atomic row, and caption each preview with its filename and human-readable size.\n\nThanks to xet7 !
2026-08-17 01:17:53 +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 74888f1edf Embed attachment images in PDF exports.
Move the Excel and PDF export design and progress out of TODO Later into format-specific documentation, then complete JPEG and PNG previews for card and board PDFs with failure-safe image handling and byte-level tests.\n\nThanks to xet7 !
2026-08-17 00:37:22 +03:00
Lauri Ojansivu f6e3144452 Step 4: the PDF draws the shared card document, so both formats have one layout.
"PDF export layout should be like Excel layout", and "export board, swimlane,
list, card to Excel and PDF should have same layout like export card to Excel" -
with markdown rendered and only the fields that have data.

The PDF laid a card out itself: a hundred and sixty lines that had to be kept in
step with the Excel exporter's layout by hand, and were not. The Excel export
drew sections under filled headers with label/value columns; the PDF drew a flat
list of monospaced lines. Both ask models/lib/cardDocument.js for the layout now
and only the drawing differs, so a section added to one is in the other.

WHAT A PAGE MAKES OF THE DOCUMENT, in pdfDocument.js: a section is a filled grey
bar, a meta block is a row of label/value columns with the labels in bold, text
is markdown wrapped and styled, a list keeps its marker, a comment keeps its
date and its author. The bars are real rectangles - drawn outside BT/ET, because
a PDF text object may not contain a path - and the y of each line is known from
its index, so it needs no layout pass.

What is left in the exporter is the MAPPING: Meteor documents, user ids and
dates turned into the plain names and strings the document takes. That is the
only part that knows a Mongo document from a string.

FOUR REGRESSIONS THE EXISTING GUARDS CAUGHT, every one a field that would have
gone missing from the file:

  * requested by / assigned by - a card's own record of who asked for it, and a
    suite exists precisely because they have been lost from an export before;
  * card number, last activity, spent time and overtime;
  * the labels and the dates, which two suites check by name;
  * and every label's English fallback. The document was passing keys without
    one, so a missing translation would have printed "card-due" on the page.
    The words live in one table now, which also stops a PDF saying "Due" where
    a spreadsheet says "Due date".

The guards themselves follow the layout to where it went: they read the exporter
AND the document, because a field is now carried by the pair, and reading only
the exporter would report a field as lost when it had merely moved to where both
formats take it from.

Verified as far as this sandbox allows: the mapping is extracted from the file
and executed against a stand-in exporter (tests/pdfDrawsTheDocument.test.cjs),
the document it builds is checked section by section, and the bytes are checked
to be a PDF whose xref offset points at its table. There is no PDF viewer here,
so how the page LOOKS is still to be checked by eye.

Thanks to Heart1010 and xet7 !

Fixes #6586,
2026-08-16 23: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 050df89f06 Requested By and Assigned By: a + to set them, and they survive a round
trip.

Both fields were set by clicking the word "Add". They have the round + that
Members and Assignee use now, opening the same editor the text opens - the
same class, so it is the same button and not a second one that looks like
it.

Checking where else they live turned up a ROUND TRIP THAT LOST THEM, which
is the worst shape this bug takes: the export looks complete and the import
reports success. They were exported by the card PDF, the card Excel and the
board CSV, and imported by nothing - a card exported and imported back had
forgotten who asked for it and who assigned it. models/wekanCreator.js and
the per-menu scoped importer both set them now.

The board's streaming Excel TABLE exported neither, so it gained two
columns: header and value in the same commit, because a header without its
value shifts every column after it.

From other trackers, where the idea has another name: Jira's REPORTER is who
asked for the work, and an issue's AUTHOR on GitHub, Gitea, Forgejo and
GitLab is the same thing. Both arrive as Requested By, as free text, so they
survive an import from a tracker nobody on this board has an account on. A
source with no such field - Trello, CSV - gains nothing, and a negative test
says so.

Also two things the grouping left crooked, both visible on an opened card:

- Members, Assignee and Creator were each a full-width row, so the last two
  fell below the first. The class that made a FIELD full width predates the
  groups; the GROUP is the full-width row now, and its fields share it.
- A field whose title the group header had taken over put its + on the first
  line, level with its neighbours' titles. Every field in a group keeps its
  own title again: the group header names the family and folds it, the
  field's title names the field, and the + starts on the line below it.

tests/requestedAssignedByRoundTrip.test.cjs walks the whole way round - the
card, Card Settings, four exports, three importers - because this was found
by looking rather than by anything failing.

Thanks to xet7 !
2026-08-14 03:28:21 +03:00
Lauri Ojansivu fe77b7461e Stream a .zip import through an upload endpoint instead of the browser.
Reading an archive in the browser and sending its attachments as base64 over
DDP is fine for a card and wrong for a board: 2 GB of attachments become 2.7
GB in one message, in the browser's memory and then in the server's.

A .zip now goes to POST /api/import/zip as the file itself, and nothing is
ever whole in memory on the way in:

- the request body is streamed to a temp file as it arrives;
- unzipper.Open.file reads the archive's central directory, so entries are
  opened on demand rather than inflated together - what the backup restore
  already does;
- each attachment is piped from the archive into the collection by
  addAttachmentFromStream, which writes it to a temp file and hands
  Meteor-Files the PATH rather than a Buffer.

That helper is lifted out of copyFile in models/lib/fileStoreStrategy.js,
which already streamed an attachment to a temp path and called addFile - so
there is one way to add an attachment from a stream rather than two.

Where the files end up is not decided here: addFile fires the collection's
onAfterUpload, which validates the file and moves it to the default storage
configured in the Admin Panel, exactly as an ordinary upload does.

The cap is checked as the body ARRIVES rather than after
(WEKAN_IMPORT_ZIP_MAX_BYTES, 5 GB by default), so an oversized archive never
lands, and the temp file is removed in a finally whatever happens. Importing
is a write, so the route asks for board membership, and the Admin Panel's
import switch still applies.

An entry name is data, never a path: only the attachment id before the first
dash is read from it, the temp file is named by WeKan, and the path goes
through the same safeEntryPath containment check the backup restore uses.
tests/fixedVulnerabilityClasses.test.cjs caught this file the moment it read
an archive and built a path - the guard was right to ask, and asking it for
proof is cheaper than arguing that the name was ours.

A .json still travels as a document over DDP, which is what it is.

Thanks to xet7 !
2026-08-14 01:45:59 +03:00