Commit Graph
24 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 935e68dfdd GitHub organization import: repositories, issues, releases, Actions, wiki.
Import -> GitHub -> Import a whole GitHub organization makes every
repository of an organization or user its own board, opening in Board View
/ Version Control. Issues go through the ordinary importBoard, as the person
who started the job, with their comments, labels and files. Releases are
cards in a Releases list, their files attached only when chosen. Each
.github/workflows file becomes Rules. The wiki is read from its git
repository with isomorphic-git (1.42.4, pinned), every request through the
SSRF guard and only to github.com: a page is a card in the Wiki list, its
[[links]] point at and are attached to the linked pages' cards, and each
commit that changed it is a dated edit in the card's history, so Restore
brings back an older version. The job shows progress, can be cancelled,
pauses on a restart and stops at a rate limit; the token is kept in memory
only.

Version Control gains Releases and Wiki tabs: the wiki as GitHub shows it,
with the page list, _Sidebar and _Footer, links that stay in the tab, and
each page's history with Restore.

GitHub Actions workflows map to Rules: issue events to triggers, label,
close, reopen, comment, assign and create steps to actions, actions/stale to
an aging rule. Code - builds, tests, scripts - is never run: such a workflow
is a disabled rule with its YAML as the description. WeKan's Rules gain what
they lacked for it: a "commented on" trigger, an "add comment" action written
as the person whose change ran the rule and only where they may comment,
cron schedules in UTC, and a rule description shown on the rule. A disabled
rule no longer fires on a schedule or from its button, which it did.

The new strings are translated in every locale.

Thanks to xet7 !
2026-10-14 12:43:36 +03:00
Lauri Ojansivu a78b4aa744 Export Wrike Excel with Wrike's custom workflow statuses, and import and export Wrike workflows as lists and rules.
The Wrike Excel export wrote the WeKan list as a custom column named WeKan
list, which Wrike reads as a custom field rather than a status. It now
writes the five workflow columns of Wrike's import help article: Default
task workflow on folder rows, and on task rows Workflow (named after the
board), Status (the list's status group) and Custom Status (the list).
Wrike applies a custom status only when that workflow exists, matching
case, so the board's lists are also exported as that workflow: the JSON of
Wrike's GET /workflows, one custom status per list with the nearest Wrike
color. That JSON is the only exchange format, since Wrike has no file
import or export of workflows.

A list's status group comes from the board's rules. A "moved to this list,
mark complete" rule makes it Completed (Cancelled when its name says so), a
"mark incomplete" rule makes it Active (or Deferred), otherwise the name
decides. In Rules > Import / Export, a pasted Wrike workflow adds a list for
each status the board lacks, after the previous status's list, and adds the
rules that do what Wrike's status groups do. Those rules show in the list,
Workflow and Blocks views. A server method does this as a board admin and
adds nothing twice. Wrike's own automation rules have no export, import or
API, so they cannot be carried over.

The Wrike import reads Custom Status as the list and a single Workflow as
the board title. It reports a status group the status name does not imply,
since only the workflow import's rules keep it.

tests/wrikeWorkflow.test.cjs and tests/wrikeFormat.test.cjs cover the
workflow, rules, colors, refusals and round trips. Two new Playwright cases
import a workbook with the workflow columns and apply a Wrike workflow
through the Rules popup twice, and the export audit fetches the workflow.
New text is in English, pending Transifex.

Thanks to xet7 !
2026-10-09 09:48:47 +03:00
Lauri Ojansivu f735eba194 Rules: assignee actions, an optional title, and remove-all members that removes them.
#4294 asked for four things. Several triggers and actions, rule variables,
renaming in place and rule import/export were built earlier; two parts were
still missing.

- "I want the assignee to be the creator of the card by default": rules had
  member actions only. Add and Remove assignee actions take a username, a
  {creator}/{assignees}/{members} token, the user who triggered the rule, or
  "*" for every assignee, and write card.assignees. They are durable through
  Sync like the member actions, with the joinAssignee/unjoinAssignee
  activities the assignees hook writes.
- "give a Rule a default name": Add Rule with an empty title showed an
  error, and rules.createRule stored the literal "Rule". The title is now
  optional; the rule is named after its trigger and action ("When ...,
  then ..."), and the rules list renames it in place.

Fixing this found that "Remove all members from the card" iterated the
card's assignees while removing from its members: an earlier fix believed
assignMember wrote assignees, but both definitions in models/cards.js write
members. It removed only members who were also assignees. Remove-all now
iterates card.members, in the ordinary and the durable path, and the guards
that pinned the wrong collection now read models/cards.js to decide.

New text is added in English, pending Transifex.

Thanks to xeruf and xet7 !

Fixes #4294.
2026-10-08 11:31:12 +03:00
Lauri Ojansivu b7084fdc06 A rule's email follows the card to the board the rule's own move took it to.
A rule that moved a card to another board and then sent an email sent nothing:
the email source check refused a card that had left the activity's board, in
both engines. As decided, the email now reads the card on the destination
board, but only when this run of the rule made the move, the destination
opted into Sync effects, and the card is still there. The ordinary engine
remembers its run's own move (RulesHelper.emailActivity), durable Sync proves
it from a saved move of the same plan (ruleEmailActivity, ruleCardNow) and
rechecks it before sending. The stored source binding (version 6) records the
board the card left. Any other card off the board is refused as before, and
an email may now follow a move to another board in a durable plan.

Tests: binding positive and negative cases, a shape guard that nothing else
can claim a followed move, and a server test of both engines that sends once
from the destination and refuses a card nobody's run moved, a move to another
board, and a destination that opted out.

Thanks to xet7 !
2026-10-03 14:26:15 +03:00
Lauri Ojansivu 69eeb00c84 Let a rule have several triggers (any fires it) and several actions (in order).
Maintainer decision for #4294 and #2953: a rule keeps its own trigger and
action and may add up to ten more of each. It fires when any of its
triggers fires - once per activity, even when several match - and runs its
actions in order, its own first. Rule details lists the extra parts with
Add another trigger / Add another action and Remove; the new
rules.addPart/removePart methods keep the board-admin and cross-board
destination checks of rules.createRule and refuse a button as an extra
trigger.

Ordinary, scheduled and button rules, the durable Sync rule plan, rule
History (snapshot, part edits and restore), deletion, board copy, WeKan
export/import, the rules JSON export/import, the REST representation and
the admin rules report all handle every part. Two rule-engine test
harnesses now receive the new helpers they evaluate.

New strings are in en.i18n.json, pending translation.

Thanks to xet7 !

Fixes #2953,
2026-09-29 14:34:18 +03:00
Lauri Ojansivu 0e7394cd85 Keep rule button menus consistent with trigger type changes
Clear stale manual-button metadata for automatic triggers and populate it for REST button rules. Verify actual menu visibility and History undo/redo for editor and REST changes.

Thanks to xet7 !
2026-09-27 20:27:41 +03:00
Lauri Ojansivu 21cb6e8c86 Isolate shared rule components when editing automation rules
Copy changed shared triggers and actions while preserving unshared IDs and REST patch semantics. History restores component references and cleans unreferenced private copies.

Thanks to xet7 !
2026-09-27 20:24:42 +03:00
Lauri Ojansivu 7472456ada Preserve shared trigger and action records when deleting rules
Reuse one cleanup path for editor, REST and History deletion. Restore shared components only when their recorded content is unchanged, without writing over another rule.

Thanks to xet7 !
2026-09-27 20:21:30 +03:00
Lauri Ojansivu 539aef4aa5 Record rule configuration changes in undoable board history
Snapshot rules with their trigger and action, combine compound edits, and restore through existing History with board-admin checks and stale-state protection. Cover lifecycle undo/redo, member rejection and conflicting edits in Chromium.

Thanks to xet7 !
2026-09-27 17:05:30 +03:00
Lauri Ojansivu 64123a603a Bind manual rule execution to a writable board and its card
Check write capability and authoritative card board before button dispatch and again in the shared action dispatcher. Board buttons without a card remain supported. Record denied contexts in bounded Problems summaries.

Role and boundary decisions plus dispatcher inventory and existing rule suites pass. Browser regression syntax-check passes; live execution pending.

Thanks to Wenhao Wu, Southeast University and xet7 !
2026-09-14 11:53:05 +03:00
Lauri Ojansivu 952679f9c3 CHANGELOG: close the list/swimlane link issue (#1089).
Thanks to xet7 and xet7 !

Fixes #1089,
2026-09-10 21:01:12 +03:00
Lauri Ojansivu 16c8f425d0 Let a rule's trigger/action be edited in place, and email the card's description too.
#2713 asked for two things.

Editing a rule used to mean delete it and rebuild it from scratch, losing
its position and its identity. rulesList's rule row gets a second "Edit
trigger/action" button next to the existing title-rename pencil, opening
the same trigger/action wizard used to create a rule (rulesMain.js /
rulesTriggers / rulesActions and the board/card/checklist/mail action
templates), pre-filled with the rule's current title. A new server method,
rules.updateRule (server/rulesButton.js), mirrors rules.createRule's
authorization and cross-board destination checks but REPLACES the existing
trigger/action documents in place (full-document update by their existing
_id, not remove+insert), so the rule keeps its own _id, and its trigger/
action keep theirs, across an edit. Every action-template click handler
that used to call rules.createRule or insert Triggers/Actions/Rules
directly now goes through one shared helper,
client/components/rules/rulesSaveHelper.js, which picks create vs. update
based on whether the wizard was opened to edit an existing rule.

The "send an email" rule action already appended the card's title and a
link to it automatically (#3301), even when the user's own template used
none of the {card}/{cardLink} tokens; it did not do the same for the card's
description. server/rulesHelper.js now appends "Description: ..." to the
footer alongside the existing title/link lines, using the vars.description
value buildRuleVars already computed.

Actually attaching the card's FILE ATTACHMENTS to the outgoing email is
deferred - see CHANGELOG TODO Later. Every WeKan email today goes through
either Meteor's `Email.sendAsync`/`EmailLocalization.sendEmail`, which take
{ to, from, subject, text }, with no `attachments` parameter anywhere in
this codebase's call sites; wiring a real file through would need the
mailer wrapper itself to grow attachment support and code to read the file
back out of whichever storage backend (local disk / GridFS / S3) holds it,
which is mailer-level scope well past this rule action.

tests/ruleUpdateInPlace.test.cjs pins rules.updateRule's authorization,
its RuleBleed cross-board guard, and - the part that actually makes it an
edit rather than a second create - that it keeps the rule/trigger/action
_ids stable, including a logic-level round trip against a small in-memory
mock proving a changed actionType does not leave the old type's fields
behind. tests/ruleEmailIncludesDescription.test.cjs pins the new
description line, guarded the same way the existing title/line lines are
(only appended when non-empty).
tests/ruleCardActionSchema.test.cjs (#6630's guard, that desc lives on the
Action document and never leaks onto the Rule document) is updated for the
new saveRuleTriggerAction call shape.

Thanks to jvavassori and xet7 !
2026-09-10 20:37:56 +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 ac21ba5343 Add accessible parameterized rules builder 2026-09-07 03:51:55 +03:00
Lauri Ojansivu 31dc055d4e Add safe accessible HTML4 rules import 2026-09-07 03:29:19 +03:00
Lauri Ojansivu 9ec04d7401 Add accessible HTML4 rules workflow 2026-09-07 03:09:33 +03:00
Lauri Ojansivu dab13dd201 Add accessible HTML4 board rules 2026-09-07 02:59:23 +03:00
Lauri Ojansivu dffe85cce4 Block unauthorized cross-board rule actions
Validate automation destinations before storing a rule and again before executing legacy or imported move, link, and bulk-move actions. Record denied attempts through the bounded RuleBleed canary.\n\nThanks to crypto-nidh and xet7 !
2026-08-29 09:43:23 +03:00
Lauri Ojansivu ed19445d30 Fix #6459 #6455 #6458 #6466 #6467 #6468 #6472 #6465 #5547 #5282.
- #6459: card More menu rendered empty (no Delete): the vendored jade
  compiler's htmljs patch made isConstructedObject(Array) false, so
  'label {{_ ...}}:' lines got their content array mis-assigned as tag
  attributes and Blaze threw 'foreign objects in attributes' killing the
  whole cardMorePopup. Also fixed the list More link input (nonexistent
  rootUrl helper -> absoluteUrl).
- #6455: saving a card description never removed a pre-existing unsaved-
  edits record, and the draft/description comparison mismatched on Markdown
  hard-breaks and empty descriptions, re-creating a phantom draft on every
  save. Save now clears the draft; both sides normalized the same way.
- #5547: comment drafts: the draft-saving escape handler had been disarmed
  since 2019 (flag with no setter), so a comment being written was lost
  when the card closed. Drafts are now saved continuously (debounced),
  flushed on teardown, cleared on submit; text no longer visually vanishes
  on outside clicks.
- #5282: attachment delete: guard against the doc being already evicted
  from Minimongo ('Removed nonexistent document'), like the existing
  comment/checklist guards.
- #6472: rules move card to top/bottom: fall back to the card's current
  list when listName does not resolve (was a swallowed TypeError = rule
  silently did nothing); wizard stored listTitle which the engine never
  reads (listName); empty destination wrote sort +-Infinity; rules JSON/CSV
  import now uses the rules.createRule method instead of client inserts
  rejected into minimongo limbo, and defaults missing trigger matching
  fields to '*'; empty boardId no longer overrides the real board; the
  server-side orphaned-cards fallback in List.cards()/cardsUnfiltered()
  now actually resolves its async swimlane lookup.
- #6465: desktop density back to WeKan 6.09: base font 14px and headings
  22/18/16px (vw clamps resolved to 18/24px on desktop), All Boards
  wrapper padding 10px/15px, card details docks to the right edge instead
  of floating on top of its own card (still draggable), 20px canvas
  padding instead of ~48px white borders, removed the force-all-card-text-
  to-title-size rule, admin org/team table Select/Unselect-all header
  links are compact icons and header cells may wrap, zoom pill no longer
  cut off, one-click board settings cog in the board header.
- #6458 #6466: snap: mongodb-control now checks mongod's exit status and
  does an AVX pre-flight (MongoDB 5+ needs AVX; without it mongod SIGILLs)
  instead of pinging a dead port forever behind a 502: it switches to a
  completed FerretDB migration, or (re)runs the migration (AVX-free) with
  a 3-attempt guard. Migration importers no longer fail the whole run on
  >=10 per-item errors ('Avatars Errors' etc.), and a failed 3.x-source
  migration keeps the copied FerretDB data + checkpoint and resumes next
  start instead of deleting it and 'falling back' to a mongod 7 that
  cannot open 3.x data files.
- #6467 #6468: with FerretDB, calm Meteor's no-oplog polling storm
  (METEOR_POLLING_THROTTLE_MS=2000, METEOR_POLLING_INTERVAL_MS=30000
  defaults in the snap and bundle launcher; overridable). The FerretDB
  fork gets filter pushdown, a sane pool size and less locking in its own
  repo.
- Updated ChangeLog.

Thanks to xet7.
2026-07-16 17:08:31 +03:00
Lauri Ojansivu 9f7eac158e Fix #5536: Automated rule can now move/link card to a different board
The rules move-card-to-top/bottom (on another board) and link-card-to-another-board
actions failed in two ways for boards the rule creator did not own:

- The action showed BLANK after creating the rule: the wizard inserted the
  trigger/action/rule with three optimistic client Collection.insert() calls
  that landed in minimongo limbo once the wizard subscription stopped (and the
  client allow/deny rules rejected them outright for non-owner members). These
  now create the rule through the server rules.createRule method, which keeps
  the action's own destination boardId.

- Execution crashed with a generic Internal Server Error: the destination
  swimlane fallback dereferenced ._id on a possibly-undefined swimlane titled
  exactly Default, which does not exist when the destination board's default
  swimlane was renamed, translated, or the board had no such swimlane.
  Resolution now uses the board's real default swimlane and a Meteor-free
  resolver (models/lib/ruleActionResolve.js) that returns empty string instead
  of throwing. The same guard is applied to the createCard and linkCard actions.
  Unit tested (positive + negative) in tests/ruleActionResolve.test.cjs.

Thanks to DarthKillian and xet7.
2026-07-09 09:45:53 +03:00
Lauri Ojansivu 68dd14140f Fix: deleting a board rule no longer fails with "Access denied [403]"
Deleting a rule ran three separate client-side Collection.remove() calls
(Rules + Triggers + Actions). Each is gated by a per-collection allow() rule
that resolves the board from that document own boardId via
Boards.findOneAsync(doc.boardId). When a trigger/action document has no
resolvable boardId (legacy rules created before boardId was denormalised, or
docs not published to the client), the board resolves to null and
allowIsBoardAdmin returns false, so Meteor rejects the mutation with 403
"Access denied" and the delete fails even for a legitimate board admin.

Route rule deletion through a new server Meteor method rules.deleteRule, which
authorizes ONCE (active board admin or site admin) and removes the rule, its
trigger and its action server-side (bypassing the brittle client allow/deny).
The permission decision is extracted into the Meteor-free helper
models/lib/ruleDeletePermission.js and covered by
tests/ruleDeletePermission.test.cjs. No permission is loosened: only board
admins and site admins may delete, matching the board-admin gate used to
create a rule.
2026-07-09 02:14:07 +03:00
Lauri OjansivuandClaude Opus 4.8 073842b3c5 Render board/card automation buttons reliably; warn on empty WeKan import
Board/card 'button' rules now denormalise their button type/label onto the
schema-backed rules document (via a board-admin-gated rules.createRule method)
and the header/card read them from there, because the schemaless triggers
collection's documents do not reach the client over the board subscription;
the boardRules publication and the rules-list editor read from it too. Also
warn (instead of silently creating an empty board) when a pasted WeKan export
has no swimlanes/lists/cards (a broken older export).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 12:55:11 +03:00
Lauri Ojansivu f0bce67a3b More Import Export and Rules features.
Thanks to xet7 and Claude !
2026-06-15 04:07:33 +03:00