mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 18:10:06 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c739eaeeee | ||
|
|
ac365ef116 | ||
|
|
5f92c8efec | ||
|
|
320e98269e | ||
|
|
dc80a93041 | ||
|
|
bf70908c0a | ||
|
|
baaeea27e3 | ||
|
|
c7a496c9cf |
No files matched your search
@@ -124,6 +124,68 @@ its reason.
|
||||
|
||||
</details>
|
||||
|
||||
# v13.15 2026-11-18 WeKan ® release
|
||||
|
||||
**In short:** **RaceBleed** is fixed: deleting a card while somebody moves it
|
||||
to another board no longer destroys its checklists, comments and attachments
|
||||
while the card itself survives there, and a member deleting a card that was
|
||||
just moved keeps their account. REST handlers now answer **404, not 500**, for
|
||||
a swimlane, user or board that is not there.
|
||||
|
||||
This release fixes the following CRITICAL SECURITY ISSUE of [RaceBleed](https://wekan.fi/hall-of-fame/racebleed/):
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/c7a496c9cfd8f30e5bda16515eedeaa2ec80dc65">A card's children are destroyed only for a card whose own removal happened</a>. Thanks to xingmuse and xet7.</summary>
|
||||
|
||||
[GHSA-3vjg-3p4q-8fwh](https://github.com/wekan/wekan/security/advisories/GHSA-3vjg-3p4q-8fwh),
|
||||
CWE-367. The REST card delete looked the card up on the board the caller was
|
||||
authorised for, destroyed its checklists, checklist items, comments,
|
||||
attachments and subcards by card id, and removed the card itself last, keyed
|
||||
on that board and list. A move to another board landing in between left the
|
||||
card alive on a board the deleter cannot read, stripped of every child, with
|
||||
both requests answering 200. Every hooked removal had the same shape:
|
||||
collection-hooks runs `Cards.before.remove`, where the cascade was, and then
|
||||
removes by the caller's original selector - a swimlane, a delete batch, a
|
||||
parent - which a moved card no longer matches. The custom-field link clean-up
|
||||
did the same to the cards linked to it.
|
||||
|
||||
The card document is now the claim (`models/lib/claimedCardRemoval.js`): the
|
||||
single and bulk REST deletes remove the card first and destroy its children
|
||||
only when that removal matched, and the hooked removals cascade from
|
||||
`Cards.after.remove`, only for a card that is really gone. A list deletion
|
||||
removes a card only while it is still in that list, and the REST board move
|
||||
that loses to a delete is a 404 instead of a 500.
|
||||
|
||||
A delete that lost the race, or arrived after the card was moved away from
|
||||
the named board, is refused and shows in Admin Panel / Problems as RaceBleed
|
||||
(`authz.card-delete-race`, medium). It never disables the account: a stale
|
||||
view is not an attack, and PurgeBleed's critical record used to disable a
|
||||
member who deleted a card somebody had just moved.
|
||||
`tests/claimedCardRemoval.test.cjs` replays the reported race and scans
|
||||
`server/` for any cascade before or without the card's removal;
|
||||
`tests/playwright/specs/race-bleed.e2e.js` races twelve moves against
|
||||
deletes and checks that a surviving card always keeps its checklist.
|
||||
|
||||
</details>
|
||||
|
||||
and fixes the following bug:
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/baaeea27e3dc6083b5d6a39d5b44a4e6d26ca088">REST API: a handler's not-found error is a 404, not a 500</a>. Thanks to xet7.</summary>
|
||||
|
||||
`httpStatusForError` knew only `NotFound`, while about two hundred throw sites
|
||||
spell it Meteor's way - `not-found`, `board-not-found`, `user-not-found` and
|
||||
the rest. So deleting a missing swimlane, or adding a board member nobody is
|
||||
called, answered 500 "Internal server error" on a real server, though the
|
||||
unit test, which stubs the helper, saw the 404. Any name that is or ends in
|
||||
`not-found` is now a 404 with its message; anything unknown is still a 500
|
||||
carrying no detail. `tests/restNotFoundStatus.test.cjs` runs the real helper
|
||||
and fails on a spelling it would not map.
|
||||
|
||||
</details>
|
||||
|
||||
Thanks to above GitHub users for their contributions and translators for their translations.
|
||||
|
||||
# v13.14 2026-11-16 WeKan ® release
|
||||
|
||||
**In short:** a **checklist folded on a minicard** stays folded, and every
|
||||
|
||||
+10
-7
@@ -5,6 +5,16 @@ each one changed and the project status are in
|
||||
Written by `node releases/changelog-short.mjs` from CHANGELOG-big.md:
|
||||
make changes there.
|
||||
|
||||
# v13.15 2026-11-18 WeKan ® release
|
||||
|
||||
**RaceBleed** is fixed: deleting a card while somebody moves it
|
||||
to another board no longer destroys its checklists, comments and attachments
|
||||
while the card itself survives there, and a member deleting a card that was
|
||||
just moved keeps their account. REST handlers now answer **404, not 500**, for
|
||||
a swimlane, user or board that is not there.
|
||||
|
||||
[All changes in v13.15](CHANGELOG-big.md#v1315-2026-11-18-wekan--release)
|
||||
|
||||
# v13.14 2026-11-16 WeKan ® release
|
||||
|
||||
a **checklist folded on a minicard** stays folded, and every
|
||||
@@ -47,10 +57,3 @@ refused custom-field update changes nothing, ownership transfer takes only the
|
||||
boards the user administers, and deleting a missing integration answers 404.
|
||||
|
||||
[All changes in v13.11](CHANGELOG-big.md#v1311-2026-11-13-wekan--release)
|
||||
|
||||
# v13.10 2026-11-13 WeKan ® release
|
||||
|
||||
The release's **Snap Store** credential check bounds each
|
||||
snapcraft install attempt, so a Snap Store that hangs no longer stops a release.
|
||||
|
||||
[All changes in v13.10](CHANGELOG-big.md#v1310-2026-11-13-wekan--release)
|
||||
+2
-2
@@ -38,7 +38,7 @@ FROM --platform=$BUILDPLATFORM debian:trixie AS bundle
|
||||
|
||||
ARG TARGETARCH
|
||||
ARG TARGETVARIANT
|
||||
ARG VERSION=13.14
|
||||
ARG VERSION=13.15
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
COPY --chmod=755 releases/check-telemetry.py /tmp/check-telemetry.py
|
||||
@@ -151,7 +151,7 @@ ENV \
|
||||
NODE_VERSION=v26.13.1 \
|
||||
METEOR_RELEASE=METEOR@3.6.1 \
|
||||
USE_EDGE=false \
|
||||
NPM_VERSION=12.2.2 \
|
||||
NPM_VERSION=12.2.3 \
|
||||
SRC_PATH=./ \
|
||||
WITH_API=true \
|
||||
MONGO_OPLOG_URL="" \
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
appId: wekan-public/apps/77b94f60-dec9-0136-304e-16ff53095928
|
||||
appVersion: "v13.14.0"
|
||||
appVersion: "v13.15.0"
|
||||
files:
|
||||
userUploads:
|
||||
- README.md
|
||||
|
||||
@@ -10,7 +10,7 @@ This is without container (without Docker or Snap).
|
||||
|
||||
Right click and download files 1-4:
|
||||
|
||||
1. [wekan-13.14-win64.zip](https://github.com/wekan/wekan/releases/download/v13.14/wekan-13.14-win64.zip) or newest available at https://github.com/wekan/wekan/releases/
|
||||
1. [wekan-13.15-win64.zip](https://github.com/wekan/wekan/releases/download/v13.15/wekan-13.15-win64.zip) or newest available at https://github.com/wekan/wekan/releases/
|
||||
|
||||
2. [node.exe](https://nodejs.org/dist/latest-v26.x/win-x64/node.exe)
|
||||
|
||||
@@ -22,7 +22,7 @@ Right click and download files 1-4:
|
||||
|
||||
6. Double click `mongodb-windows-x86_64-7.0.34-signed.msi` . In installer, uncheck downloading MongoDB compass.
|
||||
|
||||
7. Unzip `wekan-13.14-win64.zip` , inside it is directory `bundle`, to it copy other files:
|
||||
7. Unzip `wekan-13.15-win64.zip` , inside it is directory `bundle`, to it copy other files:
|
||||
|
||||
```
|
||||
bundle (directory)
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
'use strict';
|
||||
|
||||
// RaceBleed (GHSA-3vjg-3p4q-8fwh): a card's children are destroyed only for a
|
||||
// card whose own removal really happened.
|
||||
//
|
||||
// Deleting a card used to destroy its checklists, checklist items, comments,
|
||||
// attachments and subcards FIRST and remove the card itself LAST, keyed on the
|
||||
// board (and list) the caller was authorised for. Nothing held the card still
|
||||
// in between, so a move to another board that landed in that window left the
|
||||
// card alive on a board the deleter could not even read, stripped of all its
|
||||
// children - irreversibly, with both requests answering 200. Every hooked
|
||||
// removal had the same shape: matb33:collection-hooks fetches the documents,
|
||||
// runs Cards.before.remove (where the cascade was) and only then removes by the
|
||||
// ORIGINAL selector, which a moved card no longer matches.
|
||||
//
|
||||
// The card document is the claim. Removing it is atomic and keyed on where the
|
||||
// caller was authorised, so exactly one of "the move" and "the delete" wins:
|
||||
// once it is gone a concurrent move matches nothing, and when the move won the
|
||||
// removal matches nothing and nothing else is touched.
|
||||
//
|
||||
// Pure: callers pass the collection operations in, so the race is testable as
|
||||
// arithmetic (tests/claimedCardRemoval.test.cjs).
|
||||
|
||||
// Remove `card` where `selector` still says it is, and only then its children.
|
||||
// `removeCard(selector)` returns how many documents it removed; `cascade(card)`
|
||||
// destroys the children. Returns whether the card was removed.
|
||||
async function removeClaimedCard({ card, selector, removeCard, cascade }) {
|
||||
if (!card || typeof card._id !== 'string' || !card._id) return false;
|
||||
const removed = await removeCard({ ...(selector || {}), _id: card._id });
|
||||
if (!removed) return false;
|
||||
await cascade(card);
|
||||
return true;
|
||||
}
|
||||
|
||||
// For Cards.after.remove: collection-hooks calls it for every document it
|
||||
// fetched before the removal, matched or not, so the cascade runs only when the
|
||||
// card is really gone. `exists(id)` reports whether a card with that id is still
|
||||
// stored. Returns whether the cascade ran.
|
||||
async function cascadeIfRemoved({ doc, exists, cascade }) {
|
||||
if (!doc || typeof doc._id !== 'string' || !doc._id) return false;
|
||||
if (await exists(doc._id)) return false;
|
||||
await cascade(doc);
|
||||
return true;
|
||||
}
|
||||
|
||||
module.exports = { removeClaimedCard, cascadeIfRemoved };
|
||||
@@ -255,6 +255,13 @@ const CATALOG = {
|
||||
// in what the answer CARRIED, so a log line there would fire on normal use and
|
||||
// say nothing about an attacker.
|
||||
'authz.card-delete': { category: 'authz', bleed: 'PurgeBleed', severity: 'critical', cwe: 'CWE-639' },
|
||||
// RaceBleed (GHSA-3vjg-3p4q-8fwh): a REST card delete whose card was moved to
|
||||
// another board between the lookup and the removal. The delete now loses that
|
||||
// race and touches nothing; before, it destroyed the moved card's children.
|
||||
// A delete racing a move reaches this line - the spray-and-wait attack - and so
|
||||
// does a member deleting a card somebody had just moved away, so it never
|
||||
// disables the account (a stale view is not an attack).
|
||||
'authz.card-delete-race': { category: 'authz', bleed: 'RaceBleed', severity: 'medium', cwe: 'CWE-367', blocksAccount: false },
|
||||
'authz.card-member': { category: 'authz', bleed: 'GuestBleed', severity: 'high', cwe: 'CWE-639' },
|
||||
'authz.board-list': { category: 'authz', bleed: 'StaleBleed', severity: 'medium', cwe: 'CWE-863' },
|
||||
'spoofing.author': { category: 'spoofing', bleed: 'AuthorBleed', severity: 'medium', cwe: 'CWE-345' },
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "wekan",
|
||||
"version": "v13.14.0",
|
||||
"version": "v13.15.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "wekan",
|
||||
"version": "v13.14.0",
|
||||
"version": "v13.15.0",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "wekan",
|
||||
"version": "v13.14.0",
|
||||
"version": "v13.15.0",
|
||||
"description": "Open-Source kanban",
|
||||
"private": true,
|
||||
"repository": {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<head>
|
||||
<meta charset="utf8" />
|
||||
<title>WeKan REST API v13.14</title>
|
||||
<title>WeKan REST API v13.15</title>
|
||||
<!-- needed for adaptive design -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style>
|
||||
@@ -494,11 +494,11 @@ data-styled.g652[id="sc-LDhwn"]{content:"cirFq,"}/*!sc*/
|
||||
|
||||
<body>
|
||||
|
||||
<div id="redoc"><div class="sc-jlWaFk kDulYG redoc light" style="--navbar-height:0px;--navbar-stack-height:0px"><div hidden=""><script>try{var r=document.querySelectorAll(".redoc");r=r[r.length-1];var h=document.documentElement,p=h.classList,a=[h.getAttribute("data-bs-theme"),h.getAttribute("data-theme")];var m=p.contains("dark")||a.indexOf("dark")>-1?"dark":p.contains("light")||a.indexOf("light")>-1?"light":localStorage.getItem("redoc.colorMode");if(m!=="light"&&m!=="dark")m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";r.classList.remove("light","dark");r.classList.add(m)}catch(e){}</script></div><div class="sc-NPrTd fpSCXb menu-content"><div class="sc-bJapvR eXtYur"><div data-testid="search-trigger" class="sc-eavxOQ bStpwo"><div class="sc-dGYDtq hRGWCd"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" data-component-name="icons/SearchIcon/SearchIcon" class="sc-gJaedx dpfGSp"><path d="M14.5 13.7931L10.724 10.017C11.6313 8.9277 12.0838 7.5305 11.9872 6.11608C11.8907 4.70165 11.2525 3.37891 10.2055 2.423C9.15857 1.4671 7.78336 0.951637 6.36602 0.983845C4.94867 1.01605 3.5983 1.59345 2.59582 2.59593C1.59335 3.5984 1.01595 4.94877 0.983738 6.36612C0.95153 7.78347 1.46699 9.15867 2.4229 10.2057C3.3788 11.2526 4.70155 11.8908 6.11597 11.9873C7.53039 12.0839 8.92759 11.6314 10.0169 10.7241L13.793 14.5001L14.5 13.7931ZM2.00001 6.50012C2.00001 5.6101 2.26393 4.74007 2.7584 4.00005C3.25286 3.26003 3.95567 2.68325 4.77794 2.34266C5.6002 2.00207 6.505 1.91295 7.37792 2.08658C8.25083 2.26022 9.05266 2.6888 9.68199 3.31814C10.3113 3.94747 10.7399 4.7493 10.9135 5.62221C11.0872 6.49513 10.9981 7.39993 10.6575 8.22219C10.3169 9.04446 9.7401 9.74726 9.00008 10.2417C8.26006 10.7362 7.39003 11.0001 6.50001 11.0001C5.30694 10.9988 4.16312 10.5243 3.31949 9.68064C2.47587 8.83701 2.00133 7.69319 2.00001 6.50012Z"></path></svg><span>Loading...</span></div></div></div><div class="sc-kLsiYl kAUzfx"><ul data-component-name="Menu/Menu" class="sc-jfJzNu hoWuXt"><div data-component-name="Menu/MenuItem" class="sc-jEekwy kJsUv menu-item-type-default" role="listitem"><a class="sc-gzhUzI kKmXTr" href="/" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="true" class="sc-cToEys eWEtkC"><div class="sc-fIruOr dBwuTA"><span class="sc-gwVKcS efjekG"><span data-text="WeKan REST API" class="sc-hgJgCR dWgUkd">WeKan REST API</span></span></div></li></a></div><div data-component-name="Menu/MenuItem" class="sc-jEekwy kJsUv menu-item-type-default" role="listitem"><a class="sc-gzhUzI kKmXTr" href="/section/production-security-concerns" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-cToEys iVTRMP"><div class="sc-fIruOr dBwuTA"><span class="sc-gwVKcS efjekG"><span data-text="Production Security Concerns" class="sc-hgJgCR dlVNdD">Production Security Concerns</span></span></div></li></a></div><div data-component-name="Menu/MenuItem" class="sc-jEekwy kJsUv menu-item-type-group" role="listitem"><a class="sc-gzhUzI kKmXTr" href="/login" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-cToEys jYycQW"><div class="sc-dGPMcj PCvEP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-default" data-component-name="icons/ChevronRightIcon/ChevronRightIcon" class="sc-kLEbxe eRqACJ"><path d="M11 8L6.00002 13L5.30002 12.3L9.60002 8L5.30002 3.7L6.00002 3L11 8Z"></path></svg></div><div class="sc-fIruOr dBwuTA"><span class="sc-gwVKcS efjekG"><span data-text="Login" class="sc-hgJgCR dlVNdD">Login</span></span></div></li></a><div style="display:none;height:0px;overflow:hidden" class="sc-fKDFlh joxUYR"></div></div><div data-component-name="Menu/MenuItem" class="sc-jEekwy kJsUv menu-item-type-group" role="listitem"><a class="sc-gzhUzI kKmXTr" href="/attachmentstoragesettings" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-cToEys jYycQW"><div class="sc-dGPMcj PCvEP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-default" data-component-name="icons/ChevronRightIcon/ChevronRightIcon" class="sc-kLEbxe eRqACJ"><path d="M11 8L6.00002 13L5.30002 12.3L9.60002 8L5.30002 3.7L6.00002 3L11 8Z"></path></svg></div><div class="sc-fIruOr dBwuTA"><span class="sc-gwVKcS efjekG"><span data-text="AttachmentStorageSettings" class="sc-hgJgCR dlVNdD">AttachmentStorageSettings</span></span></div></li></a><div style="display:none;height:0px;overflow:hidden" class="sc-fKDFlh joxUYR"></div></div><div data-component-name="Menu/MenuItem" class="sc-jEekwy kJsUv menu-item-type-group" role="listitem"><a class="sc-gzhUzI kKmXTr" href="/settings" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-cToEys jYycQW"><div class="sc-dGPMcj PCvEP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-defLine truncated
|
||||
<div id="redoc"><div class="sc-jlWaFk kDulYG redoc light" style="--navbar-height:0px;--navbar-stack-height:0px"><div hidden=""><script>try{var r=document.querySelectorAll(".redoc");r=r[r.length-1];var h=document.documentElement,p=h.classList,a=[h.getAttribute("data-bs-theme"),h.getAttribute("data-theme")];var m=p.contains("dark")||a.indexOf("dark")>-1?"dark":p.contains("light")||a.indexOf("light")>-1?"light":localStorage.getItem("redoc.colorMode");if(m!=="light"&&m!=="dark")m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";r.classList.remove("light","dark");r.classList.add(m)}catch(e){}</script></div><div class="sc-NPrTd fpSCXb menu-content"><div class="sc-bJapvR eXtYur"><div data-testid="search-trigger" class="sc-eavxOQ bStpwo"><div class="sc-dGYDtq hRGWCd"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" data-component-name="icons/SearchIcon/SearchIcon" class="sc-gJaedx dpfGSp"><path d="M14.5 13.7931L10.724 10.017C11.6313 8.9277 12.0838 7.5305 11.9872 6.11608C11.8907 4.70165 11.2525 3.37891 10.2055 2.423C9.15857 1.4671 7.78336 0.951637 6.36602 0.983845C4.94867 1.01605 3.5983 1.59345 2.59582 2.59593C1.59335 3.5984 1.01595 4.94877 0.983738 6.36612C0.95153 7.78347 1.46699 9.15867 2.4229 10.2057C3.3788 11.2526 4.70155 11.8908 6.11597 11.9873C7.53039 12.0839 8.92759 11.6314 10.0169 10.7241L13.793 14.5001L14.5 13.7931ZM2.00001 6.50012C2.00001 5.6101 2.26393 4.74007 2.7584 4.00005C3.25286 3.26003 3.95567 2.68325 4.77794 2.34266C5.6002 2.00207 6.505 1.91295 7.37792 2.08658C8.25083 2.26022 9.05266 2.6888 9.68199 3.31814C10.3113 3.94747 10.7399 4.7493 10.9135 5.62221C11.0872 6.49513 10.9981 7.39993 10.6575 8.22219C10.3169 9.04446 9.7401 9.74726 9.00008 10.2417C8.26006 10.7362 7.39003 11.0001 6.50001 11.0001C5.30694 10.9988 4.16312 10.5243 3.31949 9.68064C2.47587 8.83701 2.00133 7.69319 2.00001 6.50012Z"></path></svg><span>Loading...</span></div></div></div><div class="sc-kLsiYl kAUzfx"><ul data-component-name="Menu/Menu" class="sc-jfJzNu hoWuXt"><div data-component-name="Menu/MenuItem" class="sc-jEekwy kJsUv menu-item-type-default" role="listitem"><a class="sc-gzhUzI kKmXTr" href="/" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="true" class="sc-cToEys eWEtkC"><div class="sc-fIruOr dBwuTA"><span class="sc-gwVKcS efjekG"><span data-text="WeKan REST API" class="sc-hgJgCR dWgUkd">WeKan REST API</span></span></div></li></a></div><div data-component-name="Menu/MenuItem" class="sc-jEekwy kJsUv menu-item-type-default" role="listitem"><a class="sc-gzhUzI kKmXTr" href="/section/production-security-concerns" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-cToEys iVTRMP"><div class="sc-fIruOr dBwuTA"><span class="sc-gwVKcS efjekG"><span data-text="Production Security Concerns" class="sc-hgJgCR dlVNdD">Production Security Concerns</span></span></div></li></a></div><div data-component-name="Menu/MenuItem" class="sc-jEekwy kJsUv menu-item-type-group" role="listitem"><a class="sc-gzhUzI kKmXTr" href="/login" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-cToEys jYycQW"><div class="sc-dGPMcj PCvEP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-default" data-component-name="icons/ChevronRightIcon/ChevronRightIcon" class="sc-kLEbxe eRqACJ"><path d="M11 8L6.00002 13L5.30002 12.3L9.60002 8L5.30002 3.7L6.00002 3L11 8Z"></path></svg></div><div class="sc-fIruOr dBwuTA"><span class="sc-gwVKcS efjekG"><span data-text="Login" class="sc-hgJgCR dlVNdD">Login</span></span></div></li></a><div style="display:none;height:0px;overflow:hidden" class="sc-fKDFlh joxUYR"></div></div><div data-component-name="Menu/MenuItem" class="sc-jEekwy kJsUv menu-item-type-group" role="listitem"><a class="sc-gzhUzI kKmXTr" href="/attachmentstoragesettings" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-cToEys jYycQW"><div class="sc-dGPMcj PCvEP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-default" data-component-name="icons/ChevronRightIcon/ChevronRightIcon" class="sc-kLEbxe eRqACJ"><path d="M11 8L6.00002 13L5.30002 12.3L9.60002 8L5.30002 3.7L6.00002 3L11 8Z"></path></svg></div><div class="sc-fIruOr dBwuTA"><span class="sc-gwVKcS efjekG"><span data-text="AttachmentStorageSettings" class="sc-hgJgCR dlVNdD">AttachmentStorageSettings</span></span></div></li></a><div style="display:none;height:0px;overflow:hidden" class="sc-fKDFlh joxUYR"></div></div><div data-component-name="Menu/MenuItem" class="sc-jEekwy kJsUv menu-item-type-group" role="listitem"><a class="sc-gzhUzI kKmXTr" href="/settings" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-cToEys jYycQW"><div class="sc-dGPMcj PCvEP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-defLine truncated
|
||||
<script type="module">
|
||||
import { hydrate } from "https://cdn.redocly.com/redoc/v3.1.0/bundles/redoc.standalone.js";
|
||||
|
||||
const __redoc_definition = {"openapi":"3.2.0","info":{"title":"WeKan REST API","version":"v13.14","description":"The REST API allows you to control and extend WeKan with ease.\n\nIf you are an end-user and not a dev or a tester, [create an issue](https://github.com/wekan/wekan/issues/new) to request new APIs.\n\n> All API calls in the documentation are made using `curl`. However, you are free to use Java / Python / PHP / Golang / Ruby / Swift / Objective-C / Rust / Scala / C# or any other programming languages.\n\n# Production Security Concerns\nWhen calling a production WeKan server, ensure it is running via HTTPS and has a valid SSL Certificate. The login method requires you to post your username and password in plaintext, which is why we highly suggest only calling the REST login api over HTTPS. Also, few things to note:\n\n* Only call via HTTPS\n* Implement a timed authorization token expiration strategy\n* Ensure the calling user only has permissions for what they are calling and no more\n"},"paths":{"/users/login":{"post":{"operationId":"login","summary":"Login with REST API","tags":["Login"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["username","password"],"properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"}}}},"application/x-www-form-urlencoded":{"schema":{"type":"object","required":["username","password"],"properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"}}}}},"description":"Login credentials","required":true},"responses":{"200":{"description":"Successful authentication","content":{"*/*":{"schema":{"type":"object","required":["id","token","tokenExpires"],"properties":{"id":{"type":"string","description":"User ID"},"token":{"type":"string","description":"Authentication token\n"},"tokenExpires":{"type":"string","format":"date-time","description":"Token expiration date\n"}}}}}},"400":{"description":"Error in authentication\n","content":{"*/*":{"schema":{"type":"object","properties":{"error":{"type":"string"},"reason":{"type":"string"}}}}}},"default":{"description":"Error in authentication\n"}}}},"/users/register":{"post":{"operationId":"register","summary":"Register with REST API","description":"Notes:\n - You will need to provide the token for any of the authenticated methods.\n","tags":["Login"],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"},"email":{"description":"Your email\n","type":"string"}},"required":["username","password","email"]}}},"required":true},"responses":{"200":{"description":"Successful registration","content":{"*/*":{"schema":{"items":{"properties":{"id":{"type":"string"},"token":{"type":"string"},"tokenExpires":{"type":"string"}}}}}}},"400":{"description":"Error in registration\n","content":{"*/*":{"schema":{"items":{"properties":{"error":{"type":"number"},"reason":{"type":"string"}}}}}}},"default":{"description":"Error in registration\n"}}}},"/api/admin/attachment-settings":{"get":{"operationId":"get_attachment_settings","summary":"Get the attachment storage / upload-block settings (GlobalAdmin)","description":"Only the global admin can call this. Returns the Admin Panel >\n Attachments settings document, including `limitSettings.attachmentsUploadBlocked`\n and `limitSettings.avatarsUploadBlocked` plus the size limits. Cloud-storage\n secret keys (S3 secretAccessKey, Azure accountKey/connectionString, GCS\n credentials) are masked and never returned; a boolean `\u003cfield>Set` marker\n shows whether a value exists.\n","tags":["AttachmentStorageSettings","Settings"],"security":[{"UserSecurity":[]}],"responses":{"200":{"description":"200 response","content":{"application/json":{"schema":{"type":"Object"}}}}}},"put":{"operationId":"update_attachment_settings","summary":"Update the attachment storage / upload-block settings (GlobalAdmin)","description":"Only the global admin can call this. The request body is a\n partial settings object (for example\n `{\"limitSettings\": {\"avatarsUploadBlocked\": true}}`). It is applied through\n the same update path as the `updateAttachmentStorageSettings` Meteor method,\n so validation and `$set` semantics are identical: cloud-storage secrets left\n blank are preserved. The masked, updated settings document is returned.\n","tags":["AttachmentStorageSettings","Settings"],"security":[{"UserSecurity":[]}],"responses":{"200":{"description":"200 response","content":{"application/json":{"schema":{"type":"Object"}}}}}}},"/api/admin/domains":{"get":{"operationId":"get_admin_domains","summary":"List email domains with their user counts (GlobalAdmin)","description":"Only the global admin can call this. CountsLine truncated
|
||||
const __redoc_definition = {"openapi":"3.2.0","info":{"title":"WeKan REST API","version":"v13.15","description":"The REST API allows you to control and extend WeKan with ease.\n\nIf you are an end-user and not a dev or a tester, [create an issue](https://github.com/wekan/wekan/issues/new) to request new APIs.\n\n> All API calls in the documentation are made using `curl`. However, you are free to use Java / Python / PHP / Golang / Ruby / Swift / Objective-C / Rust / Scala / C# or any other programming languages.\n\n# Production Security Concerns\nWhen calling a production WeKan server, ensure it is running via HTTPS and has a valid SSL Certificate. The login method requires you to post your username and password in plaintext, which is why we highly suggest only calling the REST login api over HTTPS. Also, few things to note:\n\n* Only call via HTTPS\n* Implement a timed authorization token expiration strategy\n* Ensure the calling user only has permissions for what they are calling and no more\n"},"paths":{"/users/login":{"post":{"operationId":"login","summary":"Login with REST API","tags":["Login"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["username","password"],"properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"}}}},"application/x-www-form-urlencoded":{"schema":{"type":"object","required":["username","password"],"properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"}}}}},"description":"Login credentials","required":true},"responses":{"200":{"description":"Successful authentication","content":{"*/*":{"schema":{"type":"object","required":["id","token","tokenExpires"],"properties":{"id":{"type":"string","description":"User ID"},"token":{"type":"string","description":"Authentication token\n"},"tokenExpires":{"type":"string","format":"date-time","description":"Token expiration date\n"}}}}}},"400":{"description":"Error in authentication\n","content":{"*/*":{"schema":{"type":"object","properties":{"error":{"type":"string"},"reason":{"type":"string"}}}}}},"default":{"description":"Error in authentication\n"}}}},"/users/register":{"post":{"operationId":"register","summary":"Register with REST API","description":"Notes:\n - You will need to provide the token for any of the authenticated methods.\n","tags":["Login"],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"},"email":{"description":"Your email\n","type":"string"}},"required":["username","password","email"]}}},"required":true},"responses":{"200":{"description":"Successful registration","content":{"*/*":{"schema":{"items":{"properties":{"id":{"type":"string"},"token":{"type":"string"},"tokenExpires":{"type":"string"}}}}}}},"400":{"description":"Error in registration\n","content":{"*/*":{"schema":{"items":{"properties":{"error":{"type":"number"},"reason":{"type":"string"}}}}}}},"default":{"description":"Error in registration\n"}}}},"/api/admin/attachment-settings":{"get":{"operationId":"get_attachment_settings","summary":"Get the attachment storage / upload-block settings (GlobalAdmin)","description":"Only the global admin can call this. Returns the Admin Panel >\n Attachments settings document, including `limitSettings.attachmentsUploadBlocked`\n and `limitSettings.avatarsUploadBlocked` plus the size limits. Cloud-storage\n secret keys (S3 secretAccessKey, Azure accountKey/connectionString, GCS\n credentials) are masked and never returned; a boolean `\u003cfield>Set` marker\n shows whether a value exists.\n","tags":["AttachmentStorageSettings","Settings"],"security":[{"UserSecurity":[]}],"responses":{"200":{"description":"200 response","content":{"application/json":{"schema":{"type":"Object"}}}}}},"put":{"operationId":"update_attachment_settings","summary":"Update the attachment storage / upload-block settings (GlobalAdmin)","description":"Only the global admin can call this. The request body is a\n partial settings object (for example\n `{\"limitSettings\": {\"avatarsUploadBlocked\": true}}`). It is applied through\n the same update path as the `updateAttachmentStorageSettings` Meteor method,\n so validation and `$set` semantics are identical: cloud-storage secrets left\n blank are preserved. The masked, updated settings document is returned.\n","tags":["AttachmentStorageSettings","Settings"],"security":[{"UserSecurity":[]}],"responses":{"200":{"description":"200 response","content":{"application/json":{"schema":{"type":"Object"}}}}}}},"/api/admin/domains":{"get":{"operationId":"get_admin_domains","summary":"List email domains with their user counts (GlobalAdmin)","description":"Only the global admin can call this. CountsLine truncated
|
||||
const __redoc_options = {"skipBundle":true,"disableTelemetry":false};
|
||||
|
||||
hydrate(__redoc_definition, __redoc_options, document.getElementById('redoc'));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
swagger: '2.0'
|
||||
info:
|
||||
title: WeKan REST API
|
||||
version: v13.14
|
||||
version: v13.15
|
||||
description: |
|
||||
The REST API allows you to control and extend WeKan with ease.
|
||||
|
||||
|
||||
@@ -22,10 +22,10 @@ const pkgdef :Spk.PackageDefinition = (
|
||||
appTitle = (defaultText = "Wekan"),
|
||||
# The name of the app as it is displayed to the user.
|
||||
|
||||
appVersion = 1314,
|
||||
appVersion = 1315,
|
||||
# Increment this for every release.
|
||||
|
||||
appMarketingVersion = (defaultText = "13.14~2026-11-16"),
|
||||
appMarketingVersion = (defaultText = "13.15~2026-11-18"),
|
||||
# Human-readable presentation of the app version.
|
||||
|
||||
minUpgradableAppVersion = 0,
|
||||
|
||||
@@ -80,6 +80,11 @@ export function httpStatusForError(error) {
|
||||
return error.code;
|
||||
}
|
||||
const name = error && (error.error || error.errorType || error.name);
|
||||
// Meteor's own spelling, which the handlers throw - 'not-found' and
|
||||
// 'board-not-found', 'list-not-found', 'user-not-found' ...: they were 500s,
|
||||
// so a deletion of a missing swimlane or a member add naming nobody answered
|
||||
// "Internal server error" instead of the 404 it is.
|
||||
if (typeof name === 'string' && /(^|-)not-found$/.test(name)) return 404;
|
||||
switch (name) {
|
||||
case 'Unauthorized':
|
||||
return 401;
|
||||
|
||||
+87
-26
@@ -15,6 +15,7 @@ import { computeTopSort, normalizeMoveParams, parseCardDate, parseCardScalarFiel
|
||||
const { coerceRestArrayParam } = require('/server/lib/restArrayParam');
|
||||
const { applyCardBoardConsistency } = require('/server/lib/cardBoardConsistency');
|
||||
const { stampCardListEntry } = require('/models/lib/cardListEntry');
|
||||
const { removeClaimedCard, cascadeIfRemoved } = require('/models/lib/claimedCardRemoval');
|
||||
import { titleChanged } from '/server/lib/titleChangeActivity';
|
||||
import { descriptionChanged } from '/server/lib/descriptionChangeActivity';
|
||||
import { timingChange } from '/server/lib/timingChangeActivity';
|
||||
@@ -1372,19 +1373,11 @@ Cards.before.update((userId, doc, fieldNames, modifier) => {
|
||||
});
|
||||
|
||||
Cards.before.remove(async (userId, doc) => {
|
||||
// Must be awaited: cardRemover deletes the card's checklists, checklist items,
|
||||
// comments and attachments. If not awaited, the card document is removed first
|
||||
// and those cascade removals then run with the parent card already gone, whose
|
||||
// before.remove hooks dereference an undefined card and crash SyncedCron with
|
||||
// an unhandled rejection (TypeError: ... reading 'boardId'). Awaiting here
|
||||
// removes the sub-items while the card still exists.
|
||||
await cardRemover(userId, doc);
|
||||
|
||||
// Issue #1587: permanently deleting a card must log an activity so the
|
||||
// Activities.after.insert outgoing-webhook hook fires (archiving already logs
|
||||
// an archivedCard activity, but a real delete previously logged nothing). The
|
||||
// card document still exists here (it is removed after this before.remove
|
||||
// hook), so the notify hook can resolve the card title.
|
||||
// hook), so the notify hook can resolve the card title, members and watchers.
|
||||
await Activities.insertAsync(
|
||||
buildDeleteCardActivity({
|
||||
userId,
|
||||
@@ -1397,6 +1390,24 @@ Cards.before.remove(async (userId, doc) => {
|
||||
);
|
||||
});
|
||||
|
||||
// RaceBleed (GHSA-3vjg-3p4q-8fwh): the card's checklists, checklist items,
|
||||
// comments, attachments and subcards are destroyed AFTER the card, and only when
|
||||
// it is really gone. collection-hooks runs before.remove on the documents it
|
||||
// fetched and then removes by the caller's ORIGINAL selector - by swimlane, by
|
||||
// delete batch, by parent - so a card moved to another board in between no
|
||||
// longer matched, stayed, and had lost all its children in before.remove. Here
|
||||
// a card that is still stored was not removed, and keeps them. Must be awaited,
|
||||
// so the cascade has finished when the removal returns; the children's own
|
||||
// before.remove hooks already take a missing parent card (they skip their
|
||||
// activity), and cardRemover removes the rest directly.
|
||||
Cards.after.remove(async (userId, doc) => {
|
||||
await cascadeIfRemoved({
|
||||
doc,
|
||||
exists: async id => !!(await Cards.findOneAsync({ _id: id }, { fields: { _id: 1 } })),
|
||||
cascade: card => cardRemover(userId, card),
|
||||
});
|
||||
});
|
||||
|
||||
WebApp.handlers.get(
|
||||
'/api/boards/:boardId/swimlanes/:swimlaneId/cards',
|
||||
async function(req, res) {
|
||||
@@ -2155,10 +2166,18 @@ WebApp.handlers.put(
|
||||
{ sort: ['sort'] },
|
||||
);
|
||||
const topSort = computeTopSort((destSiblings || []).map(c => c.sort));
|
||||
await Cards.direct.updateAsync(
|
||||
const movedCount = await Cards.direct.updateAsync(
|
||||
{ _id: paramCardId, listId: paramListId, boardId: paramBoardId, archived: false },
|
||||
{ $set: { boardId: newBoardId, swimlaneId: newSwimlaneId, listId: newListId, sort: topSort, lastMoveReason: moveReason } },
|
||||
);
|
||||
// RaceBleed (GHSA-3vjg-3p4q-8fwh): a card deleted (or moved) by another
|
||||
// request since it was looked up is no longer where this selector says,
|
||||
// so the move matched nothing. That is a 404, not a 500 from cardMove
|
||||
// dereferencing a card that is gone - and nothing below may run for it.
|
||||
if (!movedCount) {
|
||||
sendJsonResult(res, { code: 404, data: { error: 'Card not found' } });
|
||||
return;
|
||||
}
|
||||
updated = true;
|
||||
|
||||
const card = await ReactiveCache.getCard(paramCardId);
|
||||
@@ -2276,11 +2295,24 @@ WebApp.handlers.delete(
|
||||
if (!card) {
|
||||
const elsewhere = await ReactiveCache.getCard(paramCardId);
|
||||
if (elsewhere) {
|
||||
// RaceBleed (GHSA-3vjg-3p4q-8fwh): a card that was MOVED away from this
|
||||
// board is a delete that arrived after the move - a stale view, or one
|
||||
// that lost the race. It is refused all the same, but it is not
|
||||
// PurgeBleed: that names a card that was never here, and its critical
|
||||
// record disables the account, which a member deleting a card somebody
|
||||
// had just moved must not lose.
|
||||
const movedFromHere = await Activities.findOneAsync(
|
||||
{ activityType: 'moveCardBoard', cardId: paramCardId, oldBoardId: paramBoardId },
|
||||
{ fields: { _id: 1 } },
|
||||
);
|
||||
try {
|
||||
require('/server/lib/securityLog').record({
|
||||
key: 'authz.card-delete', action: 'blocked', source: 'DELETE /api/boards/:boardId/lists/:listId/cards/:cardId',
|
||||
key: movedFromHere ? 'authz.card-delete-race' : 'authz.card-delete',
|
||||
action: 'blocked', source: 'DELETE /api/boards/:boardId/lists/:listId/cards/:cardId',
|
||||
userId: req.userId,
|
||||
detail: `refused delete of card ${paramCardId} on board ${elsewhere.boardId} via board ${paramBoardId}`,
|
||||
detail: movedFromHere
|
||||
? `card ${paramCardId} was moved from board ${paramBoardId} to board ${elsewhere.boardId} before this delete; nothing removed`
|
||||
: `refused delete of card ${paramCardId} on board ${elsewhere.boardId} via board ${paramBoardId}`,
|
||||
});
|
||||
} catch (e) { /* logging must never break the guard */ }
|
||||
}
|
||||
@@ -2299,18 +2331,38 @@ WebApp.handlers.delete(
|
||||
sendJsonResult(res, { code: 404, data: { error: 'Card not found' } });
|
||||
return;
|
||||
}
|
||||
// Remove the card's checklists, checklist items, comments and attachments
|
||||
// BEFORE removing the card itself, so their before.remove hooks still find
|
||||
// the parent card (otherwise they dereference an undefined card and crash
|
||||
// SyncedCron with an unhandled rejection). `Cards.direct.removeAsync`
|
||||
// bypasses Cards.before.remove, so cardRemover is not run twice.
|
||||
// RaceBleed (GHSA-3vjg-3p4q-8fwh): the card is removed FIRST, keyed on the
|
||||
// board and list the caller was authorised for, and its checklists,
|
||||
// checklist items, comments, attachments and subcards only when that
|
||||
// removal matched. They used to go first, and a move to another board that
|
||||
// landed between the lookup above and the removal left the card alive on a
|
||||
// board the caller cannot read, stripped of all its children. Now exactly
|
||||
// one of the two wins. `Cards.direct.removeAsync` bypasses the hooks, so
|
||||
// cardRemover runs once, here.
|
||||
noteAuthorSpoof(req, 'DELETE card');
|
||||
await cardRemover(req.userId, card);
|
||||
await Cards.direct.removeAsync({
|
||||
_id: paramCardId,
|
||||
listId: paramListId,
|
||||
boardId: paramBoardId,
|
||||
const removed = await removeClaimedCard({
|
||||
card,
|
||||
selector: { listId: paramListId, boardId: paramBoardId },
|
||||
removeCard: selector => Cards.direct.removeAsync(selector),
|
||||
cascade: claimed => cardRemover(req.userId, claimed),
|
||||
});
|
||||
if (!removed) {
|
||||
// The card left this board or list after it was looked up: the delete
|
||||
// lost the race, so it touched nothing. Recorded like the refusal above
|
||||
// when the card now lives elsewhere.
|
||||
const moved = await ReactiveCache.getCard(paramCardId);
|
||||
if (moved) {
|
||||
try {
|
||||
require('/server/lib/securityLog').record({
|
||||
key: 'authz.card-delete-race', action: 'blocked', source: 'DELETE /api/boards/:boardId/lists/:listId/cards/:cardId',
|
||||
userId: req.userId,
|
||||
detail: `card ${paramCardId} moved to board ${moved.boardId} while it was being deleted via board ${paramBoardId}; nothing removed`,
|
||||
});
|
||||
} catch (e) { /* logging must never break the guard */ }
|
||||
}
|
||||
sendJsonResult(res, { code: 404, data: { error: 'Card not found' } });
|
||||
return;
|
||||
}
|
||||
// Issue #1587: Cards.direct.removeAsync bypasses Cards.before.remove, so log
|
||||
// the deleteCard activity here too (outgoing-webhook fires on delete).
|
||||
await Activities.insertAsync(
|
||||
@@ -2356,11 +2408,20 @@ WebApp.handlers.delete('/api/boards/:boardId/cards/bulk', async function(req, re
|
||||
notFound.push(cardId);
|
||||
continue;
|
||||
}
|
||||
// Remove sub-items (checklists, items, comments, attachments) before the
|
||||
// card itself so their before.remove hooks still find the parent card.
|
||||
// RaceBleed (GHSA-3vjg-3p4q-8fwh): the card first, keyed on this board,
|
||||
// and its checklists, items, comments, attachments and subcards only when
|
||||
// that removal matched - a card moved away meanwhile keeps them all.
|
||||
noteAuthorSpoof(req, 'DELETE cards/bulk');
|
||||
await cardRemover(req.userId, card);
|
||||
await Cards.direct.removeAsync({ _id: cardId, boardId: paramBoardId });
|
||||
const removed = await removeClaimedCard({
|
||||
card,
|
||||
selector: { boardId: paramBoardId },
|
||||
removeCard: selector => Cards.direct.removeAsync(selector),
|
||||
cascade: claimed => cardRemover(req.userId, claimed),
|
||||
});
|
||||
if (!removed) {
|
||||
notFound.push(cardId);
|
||||
continue;
|
||||
}
|
||||
// Issue #1587: Cards.direct.removeAsync bypasses Cards.before.remove, so log
|
||||
// the deleteCard activity here too (outgoing-webhook fires on delete).
|
||||
await Activities.insertAsync(
|
||||
|
||||
@@ -38,6 +38,7 @@ import { buildCardRelativeUrl } from '/models/lib/cardUrl';
|
||||
import { tripCanaryDeny } from '/server/lib/canary';
|
||||
const { collectionWriteSucceeded } = require('/server/lib/collectionWriteOutcome');
|
||||
const { assignedOnlyCardScope } = require('/models/lib/boardCardScope');
|
||||
const { cascadeIfRemoved } = require('/models/lib/claimedCardRemoval');
|
||||
const { mayWriteField } = require('/models/lib/adminOnlyCustomFields');
|
||||
const {
|
||||
MAX_FIELD_LINKS, CHOOSABLE_MODES, mirrorMode, sendsAlong, normalizeFieldLinks, isMirrored,
|
||||
@@ -167,12 +168,21 @@ Cards.before.insert((userId, doc) => {
|
||||
if (doc && Object.hasOwn(doc, 'customFieldLinks')) delete doc.customFieldLinks;
|
||||
});
|
||||
|
||||
// A deleted card leaves no link behind on the cards it was linked to.
|
||||
Cards.before.remove(async (userId, doc) => {
|
||||
// A deleted card leaves no link behind on the cards it was linked to - once it
|
||||
// is really deleted. RaceBleed (GHSA-3vjg-3p4q-8fwh): collection-hooks removes
|
||||
// by the caller's original selector after the before hooks, so a card moved
|
||||
// away in between stays, and must keep the links the other cards hold to it.
|
||||
Cards.after.remove(async (userId, doc) => {
|
||||
const ids = normalizeFieldLinks(doc && doc.customFieldLinks, doc && doc._id).map(link => link.cardId);
|
||||
if (!ids.length) return;
|
||||
await Cards.direct.updateAsync({ _id: { $in: ids } },
|
||||
{ $pull: { customFieldLinks: { cardId: doc._id } } }, { multi: true });
|
||||
await cascadeIfRemoved({
|
||||
doc,
|
||||
exists: async id => !!(await Cards.findOneAsync({ _id: id }, { fields: { _id: 1 } })),
|
||||
cascade: async gone => {
|
||||
await Cards.direct.updateAsync({ _id: { $in: ids } },
|
||||
{ $pull: { customFieldLinks: { cardId: gone._id } } }, { multi: true });
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
async function editableCard(userId, cardId) {
|
||||
|
||||
@@ -738,7 +738,7 @@ Lists.before.remove(async (userId, doc) => {
|
||||
if (cards) {
|
||||
for (const card of cards) {
|
||||
if (!doc.archived) {
|
||||
await Cards.removeAsync(card._id);
|
||||
await Cards.removeAsync({ _id: card._id, listId: doc._id }); // RaceBleed: only while it is still in this list
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -751,7 +751,7 @@ Lists.before.remove(async (userId, doc) => {
|
||||
cardArchivedAt >= listArchivedAt;
|
||||
|
||||
if (shouldDeleteCard) {
|
||||
await Cards.removeAsync(card._id);
|
||||
await Cards.removeAsync({ _id: card._id, listId: doc._id }); // RaceBleed: only while it is still in this list
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -19,7 +19,7 @@
|
||||
# base: core24 (not core26) · no build-base: devel · grade: stable
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
name: wekan
|
||||
version: '13.14'
|
||||
version: '13.15'
|
||||
base: core24
|
||||
confinement: strict
|
||||
grade: stable
|
||||
@@ -703,18 +703,18 @@ parts:
|
||||
armhf) WEKAN_ARCH="armhf" ;;
|
||||
*) echo "Unsupported architecture: ${CRAFT_ARCH_BUILD_FOR}"; exit 1 ;;
|
||||
esac
|
||||
WEKAN_ZIP="wekan-13.14-${WEKAN_ARCH}.zip"
|
||||
WEKAN_ZIP="wekan-13.15-${WEKAN_ARCH}.zip"
|
||||
echo "Cleaning environment first"
|
||||
rm -rf .build
|
||||
mkdir .build
|
||||
cd .build
|
||||
#wget https://github.com/wekan/wekan/releases/download/v13.14/wekan-13.14-amd64.zip
|
||||
#wget https://github.com/wekan/wekan/releases/download/v13.15/wekan-13.15-amd64.zip
|
||||
# Retry: a release asset can 404 for a short while right after it is
|
||||
# uploaded (CDN/propagation lag), and a plain wget treated that as
|
||||
# fatal. --retry-on-http-error covers the 404/5xx window; a genuinely
|
||||
# missing bundle still fails after the tries are spent.
|
||||
wget --tries=20 --waitretry=20 --retry-on-http-error=404,403,500,502,503 \
|
||||
"https://github.com/wekan/wekan/releases/download/v13.14/${WEKAN_ZIP}"
|
||||
"https://github.com/wekan/wekan/releases/download/v13.15/${WEKAN_ZIP}"
|
||||
unzip "${WEKAN_ZIP}"
|
||||
python3 ../releases/check-telemetry.py --bundle bundle
|
||||
rm "${WEKAN_ZIP}"
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
'use strict';
|
||||
|
||||
// RaceBleed (GHSA-3vjg-3p4q-8fwh): a card's children are destroyed only for a
|
||||
// card whose own removal really happened.
|
||||
//
|
||||
// The REST card delete looked the card up on the board the caller was
|
||||
// authorised for, destroyed its checklists, checklist items, comments,
|
||||
// attachments and subcards by cardId alone, and removed the card itself last,
|
||||
// keyed on that board. A move to another board landing in between left the card
|
||||
// alive on a board the deleter cannot read, with every child gone. The hooked
|
||||
// removals had the same shape: collection-hooks runs Cards.before.remove (the
|
||||
// cascade) and then removes by the caller's ORIGINAL selector.
|
||||
//
|
||||
// The first tests replay the reporter's race against the pure decision with an
|
||||
// in-memory store; the rest read the source and fail if any card cascade can run
|
||||
// before - or without - the card's own removal, anywhere in server/.
|
||||
//
|
||||
// Run: node tests/claimedCardRemoval.test.cjs
|
||||
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const { test } = require('node:test');
|
||||
const { removeClaimedCard, cascadeIfRemoved } = require('../models/lib/claimedCardRemoval');
|
||||
|
||||
const root = path.join(__dirname, '..');
|
||||
const read = rel => fs.readFileSync(path.join(root, rel), 'utf8');
|
||||
|
||||
// A tiny store: cards by id, and the children cardRemover would destroy.
|
||||
function store() {
|
||||
const cards = new Map([['c', { _id: 'c', boardId: 'A', listId: 'l' }]]);
|
||||
const children = new Map([['c', ['checklist', 'item', 'comment', 'attachment']]]);
|
||||
const matches = (doc, sel) => Object.entries(sel).every(([k, v]) => doc[k] === v);
|
||||
return {
|
||||
cards,
|
||||
children,
|
||||
move(id, boardId) { const d = cards.get(id); if (d) d.boardId = boardId; },
|
||||
async removeCard(sel) {
|
||||
const doc = cards.get(sel._id);
|
||||
if (!doc || !matches(doc, sel)) return 0;
|
||||
cards.delete(sel._id);
|
||||
return 1;
|
||||
},
|
||||
async cascade(card) { children.delete(card._id); },
|
||||
async exists(id) { return cards.has(id); },
|
||||
};
|
||||
}
|
||||
|
||||
test('the reporter\'s race: the move lands after the lookup, the delete touches nothing', async () => {
|
||||
const s = store();
|
||||
const looked = { ...s.cards.get('c') }; // the DELETE handler's board-scoped lookup
|
||||
s.move('c', 'Secret'); // the admin's PUT wins the window
|
||||
const removed = await removeClaimedCard({
|
||||
card: looked, selector: { boardId: 'A', listId: 'l' },
|
||||
removeCard: sel => s.removeCard(sel), cascade: c => s.cascade(c),
|
||||
});
|
||||
assert.equal(removed, false, 'the delete lost the race and says so (the handler answers 404)');
|
||||
assert.equal(s.cards.get('c').boardId, 'Secret', 'the card is on the board it was moved to');
|
||||
assert.deepEqual(s.children.get('c'), ['checklist', 'item', 'comment', 'attachment'],
|
||||
'and keeps every checklist, item, comment and attachment');
|
||||
});
|
||||
|
||||
test('negative: the old order - children first, guarded removal last - loses them in that race', async () => {
|
||||
// What the code did before: kept here so the test proves the race is real
|
||||
// rather than that the new helper happens to pass.
|
||||
const s = store();
|
||||
const looked = { ...s.cards.get('c') };
|
||||
s.move('c', 'Secret');
|
||||
await s.cascade(looked);
|
||||
const removed = await s.removeCard({ _id: 'c', boardId: 'A', listId: 'l' });
|
||||
assert.equal(removed, 0);
|
||||
assert.ok(s.cards.has('c') && !s.children.has('c'), 'the card survived without its children');
|
||||
});
|
||||
|
||||
test('the delete wins: the card is gone, then its children, and a later move finds nothing', async () => {
|
||||
const s = store();
|
||||
const removed = await removeClaimedCard({
|
||||
card: { ...s.cards.get('c') }, selector: { boardId: 'A', listId: 'l' },
|
||||
removeCard: sel => s.removeCard(sel), cascade: c => s.cascade(c),
|
||||
});
|
||||
assert.equal(removed, true);
|
||||
assert.ok(!s.cards.has('c') && !s.children.has('c'));
|
||||
s.move('c', 'Secret');
|
||||
assert.ok(!s.cards.has('c'), 'nothing is left to move');
|
||||
});
|
||||
|
||||
test('the selector can never be widened past the card: _id always comes from the card', async () => {
|
||||
const seen = [];
|
||||
await removeClaimedCard({
|
||||
card: { _id: 'c' }, selector: { _id: 'other', boardId: 'A' },
|
||||
removeCard: async sel => { seen.push(sel); return 0; }, cascade: async () => assert.fail('no cascade'),
|
||||
});
|
||||
assert.deepEqual(seen, [{ _id: 'c', boardId: 'A' }]);
|
||||
for (const card of [null, undefined, {}, { _id: '' }, { _id: { $ne: null } }]) {
|
||||
assert.equal(await removeClaimedCard({
|
||||
card, selector: {}, removeCard: async () => assert.fail('no removal'), cascade: async () => assert.fail('no cascade'),
|
||||
}), false, JSON.stringify(card));
|
||||
}
|
||||
});
|
||||
|
||||
test('after.remove: the cascade runs for a card that is gone, never for one that stayed', async () => {
|
||||
const s = store();
|
||||
const doc = { ...s.cards.get('c') };
|
||||
assert.equal(await cascadeIfRemoved({ doc, exists: id => s.exists(id), cascade: c => s.cascade(c) }), false,
|
||||
'collection-hooks calls after.remove for a fetched card the selector no longer matched');
|
||||
assert.ok(s.children.has('c'));
|
||||
s.cards.delete('c');
|
||||
assert.equal(await cascadeIfRemoved({ doc, exists: id => s.exists(id), cascade: c => s.cascade(c) }), true);
|
||||
assert.ok(!s.children.has('c'));
|
||||
});
|
||||
|
||||
// ── the shape, everywhere ────────────────────────────────────────────────────
|
||||
|
||||
// Every server file, without the bundler's copy (_build) or the tool area.
|
||||
function serverFiles(dir = 'server', out = []) {
|
||||
for (const entry of fs.readdirSync(path.join(root, dir), { withFileTypes: true })) {
|
||||
const rel = path.join(dir, entry.name);
|
||||
if (entry.isDirectory()) serverFiles(rel, out);
|
||||
else if (entry.name.endsWith('.js')) out.push(rel);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
test('negative: no card cascade runs in Cards.before.remove, anywhere in server/', () => {
|
||||
// A before hook runs before the removal it cannot know will match.
|
||||
for (const file of serverFiles()) {
|
||||
const src = read(file);
|
||||
let at = -1;
|
||||
while ((at = src.indexOf('Cards.before.remove(', at + 1)) !== -1) {
|
||||
const body = src.slice(at, src.indexOf('\n});', at));
|
||||
for (const shape of ['cardRemover(', '.removeAsync(', 'customFieldLinks: {']) {
|
||||
assert.ok(!body.includes(shape), `${file}: Cards.before.remove must not run ${shape}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test('negative: every direct cardRemover call goes through the claim', () => {
|
||||
for (const file of serverFiles()) {
|
||||
const src = read(file);
|
||||
let at = -1;
|
||||
while ((at = src.indexOf('cardRemover(', at + 1)) !== -1) {
|
||||
const line = src.slice(src.lastIndexOf('\n', at) + 1, src.indexOf('\n', at));
|
||||
if (/^\s*(\/\/|\*)/.test(line) || /^\s*cardRemover,\s*$/.test(line)) continue;
|
||||
assert.match(line, /cascade: \w+ => cardRemover\(/, `${file}: ${line.trim()}`);
|
||||
}
|
||||
}
|
||||
const cards = read('server/models/cards.js');
|
||||
assert.equal((cards.match(/removeClaimedCard\(\{/g) || []).length, 2, 'the single and the bulk delete');
|
||||
assert.ok(/Cards\.after\.remove\(async \(userId, doc\) => \{\s*await cascadeIfRemoved\(/.test(cards),
|
||||
'the hooked removals cascade from after.remove, gated on the card being gone');
|
||||
});
|
||||
|
||||
test('negative: a list deletion removes a card only while it is still in that list', () => {
|
||||
const lists = read('server/models/lists.js');
|
||||
const hook = lists.slice(lists.indexOf('Lists.before.remove('), lists.indexOf('\n});', lists.indexOf('Lists.before.remove(')));
|
||||
assert.ok(!/Cards\.removeAsync\(card\._id\)/.test(hook), 'not by a bare id, which follows a moved card');
|
||||
assert.equal((hook.match(/Cards\.removeAsync\(\{ _id: card\._id, listId: doc\._id \}\)/g) || []).length, 2);
|
||||
});
|
||||
|
||||
test('the lost race is visible in Admin Panel / Problems as RaceBleed', () => {
|
||||
const cards = read('server/models/cards.js');
|
||||
assert.match(cards, /key: 'authz\.card-delete-race', action: 'blocked'/);
|
||||
const entry = require('../models/lib/securityCategories').CATALOG['authz.card-delete-race'];
|
||||
assert.ok(entry, 'the catalog key exists');
|
||||
assert.equal(entry.bleed, 'RaceBleed');
|
||||
assert.equal(entry.cwe, 'CWE-367');
|
||||
// A member whose delete arrived after somebody else's move is not attacking:
|
||||
// the record must never disable the account (negative: PurgeBleed's does).
|
||||
assert.equal(entry.blocksAccount, false);
|
||||
assert.notEqual(require('../models/lib/securityCategories').CATALOG['authz.card-delete'].blocksAccount, false);
|
||||
});
|
||||
|
||||
test('negative: the REST board move that lost to a delete is a 404, never a crash in cardMove', () => {
|
||||
// The other half of the race: the delete won, so the move's keyed update
|
||||
// matched nothing, and cardMove then read `boardId` of a card that is gone
|
||||
// (500). The update's count decides, before anything else runs for it.
|
||||
const cards = read('server/models/cards.js');
|
||||
const at = cards.indexOf('const movedCount = await Cards.direct.updateAsync(');
|
||||
assert.ok(at > 0, 'the board move keeps its update count');
|
||||
const after = cards.slice(at, cards.indexOf('await cardMove(', at));
|
||||
assert.match(after, /if \(!movedCount\) \{\s*sendJsonResult\(res, \{ code: 404, data: \{ error: 'Card not found' \} \}\);\s*return;/);
|
||||
assert.ok(after.indexOf('if (!movedCount)') < after.indexOf('syncCardChildrenBoard('), 'before the children are re-homed');
|
||||
});
|
||||
@@ -246,7 +246,11 @@ test('a propagation writes only while its creator can edit both cards, as that c
|
||||
test('the link field is the server\'s: client writes are refused and watched, copies start unlinked, deletes clean up', () => {
|
||||
assert.match(server, /fieldNames\.includes\('customFieldLinks'\)\) return tripCanaryDeny\('card\.field-link-direct'/);
|
||||
assert.match(server, /Cards\.before\.insert\([^)]*\) => \{\s*if \(doc && Object\.hasOwn\(doc, 'customFieldLinks'\)\) delete doc\.customFieldLinks;/);
|
||||
assert.match(server, /Cards\.before\.remove[\s\S]*\$pull: \{ customFieldLinks: \{ cardId: doc\._id \} \}/);
|
||||
// RaceBleed (GHSA-3vjg-3p4q-8fwh): the clean-up moved from before.remove to
|
||||
// after.remove and runs only when the card is really gone - a card moved away
|
||||
// while it was being deleted stays, and keeps the links held to it.
|
||||
assert.match(server, /Cards\.after\.remove[\s\S]*cascadeIfRemoved\([\s\S]*\$pull: \{ customFieldLinks: \{ cardId: gone\._id \} \}/);
|
||||
assert.ok(!/Cards\.before\.remove[^\n]*\n[^}]*customFieldLinks: \{ cardId/.test(server), 'not before the removal (negative)');
|
||||
assert.match(read('server/imports.js'), /import '\/server\/models\/customFieldLinks';/);
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* RaceBleed (GHSA-3vjg-3p4q-8fwh): a card DELETE racing a move to another
|
||||
* board must never leave the card alive without its children.
|
||||
*
|
||||
* The REST card delete destroyed the card's checklists, checklist items,
|
||||
* comments and attachments by cardId FIRST, and removed the card itself last,
|
||||
* keyed on the board the caller was authorised for. A move landing in between
|
||||
* left the card on the other board, stripped of every child, with both
|
||||
* requests answering 200. Now the card's own removal is the claim: exactly one
|
||||
* of the two requests wins, and its result is consistent either way.
|
||||
*
|
||||
* Timing decides which request wins a round, so the assertion is the
|
||||
* invariant, not the winner: a card that is still stored still has its
|
||||
* checklist and item, and a card that is gone took them with it.
|
||||
*
|
||||
* Requires the API server (WITH_API=true), like spec 17.
|
||||
*/
|
||||
|
||||
const { test, expect } = require('../fixtures');
|
||||
const db = require('../helpers/db');
|
||||
|
||||
const ROUNDS = 12;
|
||||
|
||||
function authHeaders(token, json = false) {
|
||||
const h = { Authorization: `Bearer ${token}` };
|
||||
if (json) h['Content-Type'] = 'application/json';
|
||||
return h;
|
||||
}
|
||||
|
||||
// A card on board A with one checklist holding one item.
|
||||
function seedCardWithChecklist(board, round) {
|
||||
const cardId = db.uid('card');
|
||||
const checklistId = db.uid('checklist');
|
||||
const itemId = db.uid('item');
|
||||
const now = new Date();
|
||||
db.insertOne('cards', {
|
||||
_id: cardId, title: `Race ${round}`, boardId: board.boardId, listId: board.listIds[0],
|
||||
swimlaneId: board.swimlaneId, type: 'cardType-card', archived: false, parentId: '',
|
||||
members: [], labelIds: [], customFields: [], assignees: [], userId: board.owner.id,
|
||||
sort: 1000 + round, createdAt: now, modifiedAt: now, dateLastActivity: now,
|
||||
});
|
||||
db.insertOne('checklists', { _id: checklistId, cardId, boardId: board.boardId, title: 'Keep me', sort: 0, createdAt: now, modifiedAt: now });
|
||||
db.insertOne('checklistItems', { _id: itemId, checklistId, cardId, boardId: board.boardId, title: 'Marked item', sort: 0, isFinished: false, createdAt: now, modifiedAt: now });
|
||||
return { cardId, checklistId, itemId };
|
||||
}
|
||||
|
||||
test.describe('RaceBleed: card DELETE racing a cross-board move', () => {
|
||||
test('negative: a card already moved away keeps its checklist, and the DELETE via the old board is 404', async ({ request, user, board }) => {
|
||||
const other = db.seedBoard({ ownerId: user.id, listCount: 1 });
|
||||
try {
|
||||
const { cardId, checklistId, itemId } = seedCardWithChecklist({ ...board, owner: user }, 0);
|
||||
db.updateOne('cards', { _id: cardId }, { $set: { boardId: other.boardId, listId: other.listIds[0], swimlaneId: other.swimlaneId } });
|
||||
|
||||
const res = await request.delete(`/api/boards/${board.boardId}/lists/${board.listIds[0]}/cards/${cardId}`, { headers: authHeaders(user.token) });
|
||||
expect(res.status()).toBe(404);
|
||||
expect(db.findOne('cards', { _id: cardId })).toBeTruthy();
|
||||
expect(db.findOne('checklists', { _id: checklistId })).toBeTruthy();
|
||||
expect(db.findOne('checklistItems', { _id: itemId })).toBeTruthy();
|
||||
} finally {
|
||||
db.cleanup({ boardIds: [other.boardId] });
|
||||
}
|
||||
});
|
||||
|
||||
test('negative: a member deleting a card somebody had just moved away is refused, and keeps their account', async ({ request, user, user2, board }) => {
|
||||
// The delete arrived after a completed REST move: a stale view, not an
|
||||
// attack. It is refused (404) and recorded as RaceBleed, which never
|
||||
// disables the account - PurgeBleed's critical record would have.
|
||||
const other = db.seedBoard({ ownerId: user.id, listCount: 1 });
|
||||
db.addBoardMember({ boardId: board.boardId, userId: user2.id });
|
||||
try {
|
||||
const { cardId, checklistId } = seedCardWithChecklist({ ...board, owner: user }, 0);
|
||||
const url = `/api/boards/${board.boardId}/lists/${board.listIds[0]}/cards/${cardId}`;
|
||||
const moveRes = await request.put(url, {
|
||||
headers: authHeaders(user.token, true),
|
||||
data: { newBoardId: other.boardId, newSwimlaneId: other.swimlaneId, newListId: other.listIds[0] },
|
||||
});
|
||||
expect(moveRes.status()).toBe(200);
|
||||
const deleteRes = await request.delete(url, { headers: authHeaders(user2.token) });
|
||||
expect(deleteRes.status()).toBe(404);
|
||||
expect(db.findOne('checklists', { _id: checklistId })).toBeTruthy();
|
||||
expect(db.findOne('users', { _id: user2.id }).loginDisabled || false).toBe(false);
|
||||
const again = await request.get(`/api/boards/${board.boardId}`, { headers: authHeaders(user2.token) });
|
||||
expect(again.status()).toBe(200);
|
||||
} finally {
|
||||
db.cleanup({ boardIds: [other.boardId] });
|
||||
}
|
||||
});
|
||||
|
||||
// As the report's proof of concept: the board admin moves the card to a board
|
||||
// of their own while another member of the source board deletes it, each with
|
||||
// their own token. A fresh member each round keeps the rounds independent.
|
||||
test('a DELETE racing a move never leaves a card without its checklist', async ({ request, user, board }) => {
|
||||
const other = db.seedBoard({ ownerId: user.id, listCount: 1 });
|
||||
const members = [];
|
||||
try {
|
||||
let survived = 0;
|
||||
let deleted = 0;
|
||||
for (let round = 1; round <= ROUNDS; round += 1) {
|
||||
const member = db.seedUser();
|
||||
members.push(member.id);
|
||||
db.addBoardMember({ boardId: board.boardId, userId: member.id });
|
||||
const { cardId, checklistId, itemId } = seedCardWithChecklist({ ...board, owner: user }, round);
|
||||
const url = `/api/boards/${board.boardId}/lists/${board.listIds[0]}/cards/${cardId}`;
|
||||
const [moveRes, deleteRes] = await Promise.all([
|
||||
request.put(url, {
|
||||
headers: authHeaders(user.token, true),
|
||||
data: { newBoardId: other.boardId, newSwimlaneId: other.swimlaneId, newListId: other.listIds[0] },
|
||||
}),
|
||||
request.delete(url, { headers: authHeaders(member.token) }),
|
||||
]);
|
||||
expect([200, 404]).toContain(deleteRes.status());
|
||||
// The move that lost to the delete matched nothing: 404, never a 500.
|
||||
expect([200, 404]).toContain(moveRes.status());
|
||||
expect(deleteRes.status() === 200 && moveRes.status() === 200, `round ${round}: both claimed to win`).toBe(false);
|
||||
|
||||
const card = db.findOne('cards', { _id: cardId });
|
||||
if (card) {
|
||||
survived += 1;
|
||||
expect(deleteRes.status(), `round ${round}: the delete reported success for a card that stayed`).toBe(404);
|
||||
expect(db.findOne('checklists', { _id: checklistId }), `round ${round}: checklist lost`).toBeTruthy();
|
||||
expect(db.findOne('checklistItems', { _id: itemId }), `round ${round}: item lost`).toBeTruthy();
|
||||
} else {
|
||||
deleted += 1;
|
||||
expect(db.findOne('checklists', { _id: checklistId })).toBeFalsy();
|
||||
expect(db.findOne('checklistItems', { _id: itemId })).toBeFalsy();
|
||||
}
|
||||
}
|
||||
expect(survived + deleted).toBe(ROUNDS);
|
||||
} finally {
|
||||
db.cleanup({ boardIds: [other.boardId], userIds: members });
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -73,7 +73,8 @@ test('custom-field updates preserve authorization, board scope, false values and
|
||||
const response = await request.put(`/api/boards/${other.boardId}/custom-fields/${field.id}`, {
|
||||
headers: headers(user.token), data: { name: 'Wrong board' },
|
||||
});
|
||||
expect(response.status()).toBe(200);
|
||||
expect(response.status()).toBe(404);
|
||||
expect(await response.json()).toEqual({ error: 'Custom field not found' });
|
||||
expect(db.findOne('customFields', { _id: field.id })).toEqual(before);
|
||||
} finally { db.cleanup({ boardIds: [other.boardId] }); }
|
||||
|
||||
|
||||
@@ -74,7 +74,8 @@ test('negative: the bulk DELETE is deliberately NOT batched', () => {
|
||||
// Its per-card work is real - cardRemover runs the sub-item hooks and each
|
||||
// card gets its own activity - so batching the reads would save one query in
|
||||
// a loop that does far more than query. Left alone on purpose.
|
||||
const del = cards.match(/const deleted = \[\];[\s\S]*?for \(const cardId of cardIds\) \{[\s\S]*?await cardRemover\(/);
|
||||
// RaceBleed: cardRemover now runs through removeClaimedCard, card first.
|
||||
const del = cards.match(/const deleted = \[\];[\s\S]*?for \(const cardId of cardIds\) \{[\s\S]*?await removeClaimedCard\([\s\S]*?cardRemover\(/);
|
||||
assert.ok(del, 'the delete handler still reads per card, and that is fine');
|
||||
});
|
||||
|
||||
|
||||
@@ -66,8 +66,12 @@ test('the single-card DELETE fetches the card WITH the board it authorised', ()
|
||||
// found nothing, and only to tell an attempt apart from an ordinary 404 for
|
||||
// the Problems log. What matters is that its result never reaches the
|
||||
// destruction: `card` is what cardRemover is given, never `elsewhere`.
|
||||
// RaceBleed (GHSA-3vjg-3p4q-8fwh) added a second bare lookup, `moved`, after
|
||||
// a removal that matched nothing - again only to classify the lost race for
|
||||
// the Problems log, and again never handed to the destruction.
|
||||
const bare = body.match(/getCard\(paramCardId\)/g) || [];
|
||||
assert.ok(bare.length <= 1, `the bare lookup appears ${bare.length} times`);
|
||||
assert.ok(bare.length <= 2, `the bare lookup appears ${bare.length} times`);
|
||||
assert.ok(!/cardRemover\(req\.userId, moved\)/.test(body), 'the moved card is never handed to cardRemover (negative)');
|
||||
if (bare.length) {
|
||||
assert.ok(/const elsewhere = await ReactiveCache\.getCard\(paramCardId\)/.test(body),
|
||||
'and it is the classification lookup, named for what it is');
|
||||
@@ -93,9 +97,14 @@ test('cardRemover only ever runs on a card that lookup returned', () => {
|
||||
// attempt note, never another lookup that could reintroduce a foreign card.
|
||||
const start = body.indexOf('if (!card || card.listId !== paramListId) {');
|
||||
assert.ok(start !== -1, 'a missing card, or one in another list, is turned away');
|
||||
const guard = body.slice(start, body.indexOf('await cardRemover('));
|
||||
// RaceBleed (GHSA-3vjg-3p4q-8fwh): cardRemover is now the cascade of
|
||||
// removeClaimedCard, which runs it only after the card's own removal matched,
|
||||
// so the guard is pinned up to that call, and the card it is given is `card`.
|
||||
const guard = body.slice(start, body.indexOf('await removeClaimedCard('));
|
||||
assert.match(guard, /code: 404[\s\S]*return;/, 'with a 404 and a return before cardRemover');
|
||||
assert.ok(guard.length > 0 && guard.length < 700, 'cardRemover follows the guard directly');
|
||||
assert.ok(guard.length > 0 && guard.length < 1400, 'the claimed removal follows the guard directly');
|
||||
assert.match(body, /await removeClaimedCard\(\{\s*card,\s*selector: \{ listId: paramListId, boardId: paramBoardId \}/,
|
||||
'it is handed the board-scoped `card`, keyed on the board and list authorised');
|
||||
assert.ok(!/getCard\(/.test(guard), 'with no lookup between the guard and the call (negative)');
|
||||
});
|
||||
|
||||
@@ -195,7 +204,7 @@ test('who did it comes from the session, not from the request body', () => {
|
||||
assert.ok(/userId: req\.userId,\n\s+swimlaneId: req\.body\.swimlaneId/.test(cards),
|
||||
'the card document itself');
|
||||
assert.ok(/const authorId = req\.userId;/.test(cards), 'bulk create');
|
||||
assert.ok((cards.match(/await cardRemover\(req\.userId, card\)/g) || []).length === 2,
|
||||
assert.ok((cards.match(/cascade: claimed => cardRemover\(req\.userId, claimed\)/g) || []).length === 2,
|
||||
'both deletes - single and bulk');
|
||||
assert.ok(/await customFieldCreation\(req\.userId, customField\)/.test(customFields),
|
||||
'custom-field create');
|
||||
@@ -227,7 +236,11 @@ test('the four attempts have catalog entries, named after their Bleed', () => {
|
||||
|
||||
test('each refusal records its attempt', () => {
|
||||
const del = handler(cards, 'delete', '/api/boards/:boardId/lists/:listId/cards/:cardId');
|
||||
assert.ok(/key: 'authz\.card-delete', action: 'blocked'/.test(del), 'PurgeBleed');
|
||||
// RaceBleed (GHSA-3vjg-3p4q-8fwh): a card that was moved away from the named
|
||||
// board is recorded as the race (medium, never disables the account) - only a
|
||||
// card that was never on it is PurgeBleed, the critical record.
|
||||
assert.ok(/key: movedFromHere \? 'authz\.card-delete-race' : 'authz\.card-delete',\s*action: 'blocked'/.test(del), 'PurgeBleed');
|
||||
assert.ok(/activityType: 'moveCardBoard', cardId: paramCardId, oldBoardId: paramBoardId/.test(del), 'told apart by the move away from this board');
|
||||
|
||||
const fn = cards.slice(cards.indexOf('async function assignableOnBoard'));
|
||||
assert.ok(/key: 'authz\.card-member', action: 'blocked'/.test(fn.slice(0, 1200)), 'GuestBleed');
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
'use strict';
|
||||
|
||||
// A REST handler that throws Meteor's `new Meteor.Error('not-found', ...)`
|
||||
// answers 404 with its message, not a 500 "Internal server error".
|
||||
//
|
||||
// httpStatusForError knew only 'NotFound', while the handlers - about a
|
||||
// hundred throw sites in server/ - spell it Meteor's way, 'not-found'. So
|
||||
// DELETE of a missing swimlane, and a board-member add naming nobody, were
|
||||
// 500s on the real server, while tests/restWriteRoutes404.test.cjs, which
|
||||
// stubs the helper, saw the 404 it expected. This runs the real helper.
|
||||
//
|
||||
// Run: node tests/restNotFoundStatus.test.cjs
|
||||
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const { test } = require('node:test');
|
||||
const { httpStatusForError, publicErrorData } = require('../server/lib/apiResponseHelpers');
|
||||
|
||||
const meteorError = (error, reason) => Object.assign(new Error(reason || error), { error, reason });
|
||||
|
||||
test("Meteor's 'not-found' is a 404 with its message", () => {
|
||||
assert.equal(httpStatusForError(meteorError('not-found', 'Swimlane not found')), 404);
|
||||
assert.deepEqual(publicErrorData(meteorError('not-found', 'Swimlane not found')),
|
||||
{ code: 404, data: { error: 'Swimlane not found' } });
|
||||
assert.equal(httpStatusForError(meteorError('NotFound')), 404, 'the other spelling still is');
|
||||
assert.equal(httpStatusForError(meteorError('board-not-found', 'Board not found')), 404);
|
||||
});
|
||||
|
||||
test('negative: an unknown error is still a 500 that carries no detail', () => {
|
||||
const internal = new Error('E11000 duplicate key at /srv/app/bundle/programs/server.js');
|
||||
assert.deepEqual(publicErrorData(internal), { code: 500, data: { error: 'Internal server error' } });
|
||||
assert.equal(httpStatusForError(meteorError('not-foundish')), 500);
|
||||
assert.equal(httpStatusForError(meteorError('cannot-not-founder')), 500);
|
||||
assert.equal(httpStatusForError(meteorError('Unauthorized')), 401);
|
||||
assert.equal(httpStatusForError(meteorError('Forbidden')), 403);
|
||||
});
|
||||
|
||||
test('negative: every not-found the REST handlers throw is one the helper maps', () => {
|
||||
// Any other spelling would fall back to 500 the same way.
|
||||
const spellings = new Set();
|
||||
const walk = dir => {
|
||||
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
||||
const abs = path.join(dir, entry.name);
|
||||
if (entry.isDirectory()) walk(abs);
|
||||
else if (entry.name.endsWith('.js')) {
|
||||
for (const m of fs.readFileSync(abs, 'utf8').matchAll(/Meteor\.Error\(\s*'([^']*not[-_ ]?found[^']*)'/gi)) spellings.add(m[1]);
|
||||
}
|
||||
}
|
||||
};
|
||||
walk(path.join(__dirname, '..', 'server'));
|
||||
assert.ok(spellings.has('not-found'));
|
||||
for (const name of spellings) assert.equal(httpStatusForError(meteorError(name)), 404, name);
|
||||
});
|
||||
@@ -155,9 +155,15 @@ test('list deletion: a missing or already deleted list is 404 and nothing is sof
|
||||
|
||||
// The card route keeps its board-scoped lookup and its security record; only
|
||||
// what happens after it is under test.
|
||||
function cardDelete(card, { refused = [] } = {}) {
|
||||
function cardDelete(card, { refused = [], movedTo = null } = {}) {
|
||||
const asked = [];
|
||||
const recorded = [];
|
||||
const extra = writes => ({
|
||||
removeClaimedCard: require('../models/lib/claimedCardRemoval').removeClaimedCard,
|
||||
// `movedTo`: the card left for that board after the handler looked it up,
|
||||
// so the board-and-list-keyed removal matches nothing (RaceBleed).
|
||||
...(movedTo ? { Cards: collection('Cards', writes, { count: 0 }) } : {}),
|
||||
require: () => ({ record(evt) { recorded.push(evt); } }),
|
||||
async assertListNotRefused(_userId, _board, listId) {
|
||||
asked.push(listId);
|
||||
if (refused.includes(listId)) throw Object.assign(new Error('Forbidden'), { statusCode: 403 });
|
||||
@@ -166,8 +172,11 @@ function cardDelete(card, { refused = [] } = {}) {
|
||||
noteAuthorSpoof() {},
|
||||
buildDeleteCardActivity: a => ({ activityType: 'deleteCard', cardId: a.cardId }),
|
||||
});
|
||||
const cache = { getCard: sel => (card && sel._id === card._id && (!sel.boardId || sel.boardId === card.boardId) ? card : undefined) };
|
||||
return { asked, run: params => call('server/models/cards.js', 'delete', '/api/boards/:boardId/lists/:listId/cards/:cardId', { params, cache, extra }) };
|
||||
const cache = { getCard: sel => {
|
||||
if (typeof sel === 'string') return card && sel === card._id ? { ...card, boardId: movedTo || card.boardId } : undefined;
|
||||
return card && sel._id === card._id && (!sel.boardId || sel.boardId === card.boardId) ? card : undefined;
|
||||
} };
|
||||
return { asked, recorded, run: params => call('server/models/cards.js', 'delete', '/api/boards/:boardId/lists/:listId/cards/:cardId', { params, cache, extra }) };
|
||||
}
|
||||
|
||||
test('card deletion: a missing card is 404 and nothing is removed', async () => {
|
||||
@@ -192,17 +201,32 @@ test('negative: naming a writable list does not reach a card in a list that refu
|
||||
await assert.rejects(run({ boardId: 'b', listId: 'open', cardId: 'c' }), /Forbidden/);
|
||||
});
|
||||
|
||||
test('card deletion in its own list still removes it, its children first, and records the activity', async () => {
|
||||
// RaceBleed (GHSA-3vjg-3p4q-8fwh): the card itself is removed FIRST, keyed on
|
||||
// the board and list authorised, and its children only once that matched. The
|
||||
// children used to go first, which is what a concurrent move exploited.
|
||||
test('card deletion in its own list removes the card, then its children, and records the activity', async () => {
|
||||
const card = { _id: 'c', boardId: 'b', listId: 'l', swimlaneId: 's', title: 'T' };
|
||||
const r = await cardDelete(card).run({ boardId: 'b', listId: 'l', cardId: 'c' });
|
||||
assert.deepEqual(r.response, { code: 200, data: { _id: 'c' } });
|
||||
assert.deepEqual(r.writes, [
|
||||
['Cards', 'remove', { listId: 'l', boardId: 'b', _id: 'c' }],
|
||||
['Cards', 'cardRemover', 'c'],
|
||||
['Cards', 'remove', { _id: 'c', listId: 'l', boardId: 'b' }],
|
||||
['Activities', 'insert', { activityType: 'deleteCard', cardId: 'c' }],
|
||||
]);
|
||||
});
|
||||
|
||||
test('negative: a card moved to another board mid-delete keeps its children, and the lost race is recorded', async () => {
|
||||
const card = { _id: 'c', boardId: 'b', listId: 'l', swimlaneId: 's', title: 'T' };
|
||||
const del = cardDelete(card, { movedTo: 'secret' });
|
||||
const r = await del.run({ boardId: 'b', listId: 'l', cardId: 'c' });
|
||||
assert.deepEqual(r.response, { code: 404, data: { error: 'Card not found' } });
|
||||
assert.deepEqual(r.writes, [['Cards', 'remove', { listId: 'l', boardId: 'b', _id: 'c' }]],
|
||||
'the keyed removal matched nothing: no cardRemover, no activity');
|
||||
assert.equal(del.recorded.length, 1);
|
||||
assert.equal(del.recorded[0].key, 'authz.card-delete-race');
|
||||
assert.equal(del.recorded[0].action, 'blocked');
|
||||
});
|
||||
|
||||
function dependencyRoute(verb, body) {
|
||||
const card = { _id: 'c', boardId: 'b', cardDependencies: [{ cardId: 't', type: 'blocks' }] };
|
||||
const prelude = functionSource('server/models/dependencies.js', 'hasDependencyOn');
|
||||
@@ -400,6 +424,7 @@ test('negative: the card deletion checks the list before it removes anything, an
|
||||
}
|
||||
assert.ok(callers.some(([route]) => route === '/api/boards/:boardId/cards/bulk'), 'the bulk deletion is checked');
|
||||
for (const [route, body] of callers) {
|
||||
assert.match(body, /getCard\(\{ _id: cardId, boardId: paramBoardId \}\)[\s\S]*Cards\.direct\.removeAsync\(\{ _id: cardId, boardId: paramBoardId \}\)/, route);
|
||||
// RaceBleed: the removal is the claim, keyed on the board looked up with.
|
||||
assert.match(body, /getCard\(\{ _id: cardId, boardId: paramBoardId \}\)[\s\S]*removeClaimedCard\(\{\s*card,\s*selector: \{ boardId: paramBoardId \}/, route);
|
||||
}
|
||||
});
|
||||
@@ -223,6 +223,7 @@ const GUARDED = {
|
||||
stampbleed: ['tests/stampBleed.test.cjs', 'tests/playwright/specs/upload-stamp-bleed.e2e.js'],
|
||||
listlockbleed: ['tests/listPermissions.test.cjs', 'tests/playwright/specs/list-lock-checklists.e2e.js'],
|
||||
listlockattachbleed: ['tests/listLockAttachments.test.cjs', 'tests/playwright/specs/list-lock-attachments.e2e.js'],
|
||||
racebleed: ['tests/claimedCardRemoval.test.cjs', 'tests/playwright/specs/race-bleed.e2e.js'],
|
||||
unassignedarchivebleed: ['tests/assignedCardMethods.test.cjs', 'tests/playwright/specs/assigned-card-methods.e2e.js'],
|
||||
unassignedattachbleed: ['tests/unassignedAttachBleed.test.cjs', 'tests/playwright/specs/unassigned-attach-bleed.e2e.js'],
|
||||
uploadbleed: ['tests/uploadBleed.test.cjs', 'tests/playwright/specs/upload-stamp-bleed.e2e.js'],
|
||||
@@ -377,7 +378,7 @@ test('the whole published list is accounted for', () => {
|
||||
// 145 -> 146: UnassignedArchiveBleed (GHSA-6xqf-jh8x-4wxc, 2026-11-08), guarded.
|
||||
// 146 -> 147: ListLockBleed (GHSA-4734-8vrg-8j3w, 2026-11-09), guarded.
|
||||
// 147 -> 148: ListLockAttachBleed (by email, GHSA awaited, 2026-11-11), guarded.
|
||||
assert.strictEqual(total, 148, 'the Hall of Fame and this list disagree on how many there are');
|
||||
assert.strictEqual(total, 149, 'the Hall of Fame and this list disagree on how many there are');
|
||||
});
|
||||
|
||||
test('the companion Hall of Fame names match the inventory when available', () => {
|
||||
|
||||
Reference in new issue
Block a user