mirror of
https://github.com/wekan/wekan.git
synced 2026-11-25 04:49:41 -05:00
v11.46
168
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
395f10e030 |
Add Admin Panel Nodemailer service settings
Keep service-specific values on the server, never publish passwords to the browser, and let the administrator opt out of MAIL_URL in favor of Nodemailer's bundled SMTP service profiles. Add unit, negative, publication, and browser coverage.\n\nThanks to xet7 ! |
||
|
|
c8e7b704df |
Close attachment content-type bypasses
Reject slash-separated and unquoted event handlers, validate filesystem uploads as well as migrated uploads, and force browser-executable attachment metadata through sandboxed opaque downloads on every storage backend.\n\nThanks to avrlab233 and xet7 ! |
||
|
|
162740e885 |
Keep notification title placeholders out of translations
Remove the board-only and board/card notification layouts from every locale bundle. Format those structural titles in server code, retain translation fallback for prose titles, and cover both paths plus all locale files.\n\nThanks to xet7 ! |
||
|
|
3240ddd1b9 | Supervise DEBUGSPEED instrumentation and logs | ||
|
|
186035df54 | Add opt-in database speed diagnostics | ||
|
|
12f2fddc2c |
Fix OIDC and account metadata security boundaries.
Thanks to crypto-nidh and xet7 ! |
||
|
|
b294ecfb01 |
Authenticate LDAP users through the REST login route
Route existing and first-time LDAP username credentials through Meteor server login handlers instead of requiring a local bcrypt password. Preserve uniform failures, throttling, two-factor checks, REST token creation, and local-password behavior. Thanks to mariogalan, ViViDboarder, mgiacomoli, HaKePlan and xet7 ! Fixes #3707, |
||
|
|
6ec619e438 | Bound platform resources and report runtime failures. | ||
|
|
1fa0b158ca |
Fix REST authorization and error handling.
Thanks to Char0n1507, senti-man and xet7 ! |
||
|
|
216146edc9 |
Restrict Organization and Team DDP writes.
Thanks to Char0n1507 and xet7 ! Fixes GHSA-p4cq-83j9-7g73. |
||
|
|
491781c449 |
Restore the complete WeKan Node test suite.
Backfill the new default-on opened-card custom-fields setting for existing boards. Keep regression guards aligned with the intended visibility, date controls, resizable card width, supplied initials and board publication layout, and exclude downloaded Go toolchains from the FerretDB source scan.\n\nThanks to xet7 ! |
||
|
|
ff9d0bab8b |
Add country login locations to Admin Panel People.
Place a Location column immediately before account Status. Each user shows a flag and successful-login count for every country known from that user's addresses. Clicking a country opens a Table.md report for that person. Its left menu lists countries busiest first, while the selected country shows city, IPv4, IPv6, and the person's first and last login times for each address. Search, pagination and Back use the shared table controls. Location details are fetched once per People page and restricted through the same site-admin or tenant-admin scope as the People list. Unknown locations are not guessed, stale page responses are ignored, and new logins retain their supplied location on the per-user address tally. Focused positive and negative coverage checks country totals, ordering, both address families, city rows, timestamps, menu/table wiring, authorization and missing geography. Thanks to xet7 ! |
||
|
|
49de60eb04 |
Edit linked card content from either board.
Delegate source-card edits through a visible active link when the user has write access on the board containing that link. Route content fields, attachments, checklists, subtasks, watchers, labels, custom fields, voting and poker to the source while retaining placement on the linked card. Thanks to hever and xet7 ! Fixes #1995. |
||
|
|
7a0b7b7cdb |
Audit failed permanent-delete attempts with status and address.
Record successful, failed, and unauthorized permanent-delete attempts in Recovery with Boolean Done and deleted-data fields, actor ID and username, proxy-aware IPv4 or IPv6, and requested board IDs and titles. Render Done first with green success, red failure, and yellow deletion icons. Preserve original errors after recording failed attempts. Thanks to xet7 ! |
||
|
|
c1522ad2a6 | Avoid throttling FerretDB when it is busy. | ||
|
|
6dc2651b48 |
Admin Panel / Problems / API: who called which endpoint, and how often.
Every other pane under Problems answers what went WRONG. This one answers what is being DONE: `POST /api/boards` called 34 times by alice last month, 812 times yesterday by nobody with an account. Without it the only record of REST API use is whatever the reverse proxy happens to keep, and most instances keep none. The table is username, endpoint, calls, the window they fall in, and the addresses - sorted by calls, because a usage report's question is "what is used most" where a problem report's is "what happened last". THE NAME IS THE ROUTE PATTERN, NOT THE PATH. `/api/boards/:boardId/lists` is one endpoint; `/api/boards/abc123/lists` and ten thousand of its siblings are that one endpoint being used. Naming rows after paths would put a row per board in the collection - the one-row-per-event cost this whole page exists to remove - and a request that matched NO route is counted under a single "(no route)" name rather than under the path it invented, because a 404 sweep is an attacker walking a wordlist and a row per guess would let them fill the database. ONE ROW PER ACCOUNT AND ENDPOINT, which makes the account part of a row's identity - the one deliberate exception to the rule every other stream follows. For those the question is "what is happening" and the caller would multiply the rows; here "who called what" IS the report, and the cardinality is bounded by real accounts times real endpoints. The account is stored by ID, so a rename does not split its history in two. NOTHING PER REQUEST. Ordinary API traffic is not rare the way a guard firing is rare, so calls are counted in memory and folded on a timer - a thousand requests become one write. A few seconds of counts are lost if the process stops between flushes, which is acceptable here and nowhere else on this page: this report decides nothing and nothing is protected by it. The tracked pairs are capped and the rest counted, not dropped. Counting hooks the middleware chain, not the routes, so a route cannot be added without being counted - and it counts on the response's `finish` event, which is where Express has filled req.route.path and authentication has run. The pane is the SHARED event-stream report with a different column list, not a second table page. The API stream is deliberately NOT in EVENT_STREAMS: it is usage, not a problem, and an instance serving its API would otherwise report thousands of new problems. AND THE IPv4/IPv6 SPLIT IS FINISHED WHILE HERE. The summary rows have had ipv4 and ipv6 fields since the summaries were written, and not one of the four loggers ever filled them - so the columns the design asked for could not have worked. The fold splits the address now, once, for every stream, and the two columns are one shared pair used by both reports rather than a copy each. They fall back to classifying the stored `ip`, so rows written before today display correctly instead of showing two empty columns for all of history. Seven i18n keys in 239 language files, in en.i18n.json's order, English as the placeholder where nothing is translated yet. Thanks to xet7 ! |
||
|
|
d8d1863dba |
Login offices: who logs in from where, and users shown as initials or avatar.
WHAT WAS ALREADY THERE, checked first: server/lib/loginAttemptThrottle.js resolves a client address for the REST throttle, the lockout resolves one for DDP, models/users.js has getInitials() and profile.avatarUrl, the board sidebar and cards show members through +userAvatar / +userAvatarInitials, cardDetails.js builds "open in map" links for a dozen providers, and Admin Panel tables already had a js-table-page-edit-user handler and a `userId` column option. All of it is reused rather than rewritten; only geolocation from CDN headers is new. THE TALLY, both directions from one successful login. On the user: which addresses this account uses - `100.100.100.100 25, 122.122.122.122 50`. On a new loginAddresses collection: which accounts use each address. Capped both ways with an overflow count, as the Problems summaries are. WHY THE SECOND DIRECTION EXISTS: an address several accounts log in from is an office, a VPN, a university, a carrier's NAT. Blocking it takes everyone behind it off WeKan at once - including the reverse proxy itself if HTTP_FORWARDED_COUNT is wrong, which is every user there is. So WeKan blocks the ACCOUNT that attempted the vulnerability and never the address, and this record is what lets an admin see that shape before drawing any conclusion from an address. Blocking uses loginDisabled, the field Admin Panel / People already toggles, so an admin unblocks from the table they know and no second notion of "blocked" appears beside the one that exists. `services.securityBlock` records why, from what and when. Only a 'blocked' action at high or critical severity, and only with a userId: an unauthenticated attempt has nobody to block, and guessing from the address is the mistake above. LOCATION, when something in front of WeKan already knows it: Cloudflare, Fastly, CloudFront, Vercel, Google Cloud or a hand-configured proxy. WeKan does no geolocation of its own - no database to ship, no third-party lookup of a user's address. An office in London is labelled London. DISPLAY ONLY, and the file says so twice: anything a client can send it can forge, and X-Forwarded-For at least has HTTP_FORWARDED_COUNT to say how much to believe, where a city name has nothing. USERS AS INITIALS OR AVATAR, in every Admin Panel / Problems table at once - it is one line of the shared table page, so Security, Speed, Tests, CPU, Database, Integrity and Impersonation all change together. The name is the title, so hovering still says who it is, and clicking opens the existing "Edit user" popup. Not +userAvatar: it renders its own anchor for the board's member popup, and an anchor inside the cell's anchor is invalid and would swallow the click. mapLinkFor and its Chinese datum conversions move to models/lib/mapLink.js so the card and the Admin Panel build map links the same way, with the user's own profile.mapProvider choice applying in both. Thanks to xet7 ! |
||
|
|
3d08c65bb2 |
Admin Panel Problems: one summary row per problem, with who tried and how often.
A guard on a path an attacker controls fires as fast as they can send. One
document per event meant the database grew with the attack, the Problems page
became a scroll of near-identical lines, and the one event that mattered was
buried under ten thousand that did not. The admin's question is never "list
every attempt" - it is what is happening, how much, since when, and who.
So each problem is ONE row that accumulates:
count how many times this problem has happened
firstAt … at the window it happened in
actors who, each with their own count:
username1 25, 100.100.100.100 30
username/ip the most recent occurrence
WHAT MAKES TWO EVENTS THE SAME PROBLEM is the whole design. Identity is the KIND
of thing that happened - stream, bleed, category, action, source, severity, CWE,
and the database stream's own type/db/kind. The actor is NOT part of it: a
username or an address in the key gives a row per attacker per attempt, which is
the cost being removed.
A USERNAME AND AN ADDRESS ARE TALLIED SEPARATELY, not as a pair. They answer
different questions - which account, and where from - and an unauthenticated
attempt has an address and no name. Pairing them would split one attacker across
a line per address and answer neither.
THE TALLY IS CAPPED at 50 actors, with the rest counted in actorsOverflow.
Otherwise an attacker rotating addresses grows the row with the attack and
reintroduces the same bug one level down - and "and 9,412 others" is itself the
signal that the source is spread rather than single. The cap needs to know
whether an actor is new to the row, so the row's actor keys are cached per
process: reading it on every attempt would double the database work of the thing
being made cheap, and under attack the same few actors repeat.
All three loggers share the fold (server/lib/eventLogFold.js) - a slow query in
a loop and a test failing on every run repeat just as a guard under attack does.
Still fire-and-forget and still unable to throw into the caller.
EXISTING PER-EVENT ROWS ARE FOLDED IN PLACE at startup, in batches, in JS so it
behaves the same on FerretDB as on MongoDB, and idempotently - a row with firstAt
is already a summary. Nothing is lost that the summary does not carry: counts are
summed, the earliest becomes firstAt, the latest becomes at, and the latest
occurrence's actor and detail are what the row keeps.
AND A COVERAGE CHECK, as asked: tests/hallOfFameProblemsCoverage.test.cjs
requires every hall-of-fame vulnerability to be keyed, deliberate (with the
reason, as HashBleed is), or pending. 30 of 66 are keyed; the other 35 predate
the rule and are listed as pending rather than judged here, because deciding
whether a given fix has anything to detect means reading that fix and claiming
otherwise would be worse than the gap. The pending list may shrink and may never
grow, so a NEW vulnerability without a key fails.
It found one real fault immediately: the catalog said OidcBleed and the site says
OIDCBleed, so attempts were grouping under a name nobody could look up.
Thanks to xet7 !
|
||
|
|
034a23edef |
A restart is not a crash, and a reverse proxy is not a spoofer.
Two Admin Panel reports from a server running WeKan 10.90 Snap, both full of
things that never happened.
FILESYSTEM INTEGRITY, over and over:
availability DowntimeBleed high failed uptime
the previous run STOPPED WITHOUT SHUTTING DOWN CLEANLY, and this server was
down for about 4 minute(s)
on a snap that had been refreshed, not crashed. Two faults, and the second made
the downtime real rather than merely reported:
1. `IntegrityKeys.update()` is not synchronous in Meteor 3. It starts a write
and hands back a promise nobody waited for, so the clean-shutdown mark was
never on disk when the process went, and every stop looked unclean.
2. Registering ANY listener for SIGTERM replaces Node's default behaviour,
which is to terminate. Nothing in that listener exited, so WeKan ignored
SIGTERM outright: systemd/snapd waited out its stop timeout and used
SIGKILL. That is both the minutes of "downtime" in those rows and a
genuinely unclean kill of the app on every ordinary restart - and on a snap
refresh it is minutes of the site being down for no reason.
So the mark is written with updateAsync and the handler exits: with 0, because a
stop that was asked for is a success and a non-zero code makes systemd mark the
service failed every time; after at most two seconds, because a shutdown must
never be held open by the bookkeeping about shutdowns; and exactly once, however
many signals arrive. The classification itself is untouched - the rows were
wrong because the input was wrong, and a "fix" that stopped calling a crash a
crash would hide the next real one.
SECURITY REPORT, over and over:
spoofing MetricsBleed medium detected canary:spoof.forwarded-header
127.0.0.1 denied /metrics with X-Forwarded-For present
"Nothing legitimate sends a forwarded-for header to an endpoint that does not
trust one" is what that canary assumed, and it is wrong: every reverse proxy
adds X-Forwarded-For to everything it forwards. A Prometheus scrape through a
local proxy, on a server whose METRICS_ACCEPTED_IP_ADDRESS does not cover it, is
an ordinary refusal - and it was being written up as a medium-severity spoofing
attempt from 127.0.0.1, again and again, in the report where a real one would
have to be noticed.
The spoof has a signature, so it is asked for: the header NAMES an allowlisted
address while the connection itself is not from one. That is somebody claiming
to be a whitelisted host, and only that trips the canary now. The 401 is
unchanged, and gained the sentence the admin actually needs - the address in it
is the proxy, not the scraper, unless METRICS_TRUST_PROXY says how many hops to
trust.
tests/restartIsNotACrash.test.cjs pins both, including that SIGTERM still
terminates and that the crash classification still calls a crash a crash.
Thanks to xet7 !
|
||
|
|
8ec78bb14c |
Archived cards stay archived, and a silent watch button says why.
Three email reports, 2026-08-13. "PREVIOUSLY ARCHIVED CARDS (SOME SEVERAL YEARS OLD) HAVE REAPPEARED. THESE CARDS HAVE INCORRECTLY BEEN PLACED IN THE TOP SWIMLANE." The schema upgrade's swimlane rescue treated "this card's swimlane is archived" as breakage and moved the card to the board's first VISIBLE swimlane. But archiving a swimlane is how a whole swimlane is put away: its cards stay where they are, archived: false, hidden because the swimlane is hidden. So every card anybody had ever archived that way was hoisted back into view, years later, in the top swimlane. A card is orphaned when its swimlane does not EXIST, or belongs to another board - #1959, which is still rescued. loadVisibleSwimlanes now also returns existsById, and both the check and the write use it. #1971, the issue the sweep cited, is about cards ADDED in List view landing in an archived swimlane, and that is fixed where cards are created: getDefaultSwimline() picks a non-archived swimlane. It never needed a sweep over data somebody archived on purpose. The two guards that pinned the sweep now pin the opposite, with the reason in them. "SILENT DOES NOT RESPOND. IF WE TRY TO CHANGE IT DOES NOT CHANGE. NOTHING HAPPENS." (the board's Change watch popup) Driven against a running WeKan, the popup works for a board MEMBER - level written, check mark moved, popup closed - and does nothing at all for anybody who reaches the board another way: login as non-member admin: ok watch -> ERROR error-board-notAMember A board is shared four ways: membership, an organisation, a team, and (#5850) an email domain. Only the first puts anybody in `members`, and the watch method asked hasMember(). Everyone sharing through an org, a team or a domain could open the board, see the button, and be refused the moment they used it. It now asks whether the user may SEE the board, through the same boardVisibilitySelectors the publications use, so a watch can never be granted where the board is not visible - and a revoked share (isActive: false) still is not. The other half is why nobody could tell: the popup closed on success and did NOTHING otherwise, so a refusal was indistinguishable from a dead button. It reports the reason now - the watch feature being off in the Admin Panel, or the board not being visible - and en.i18n.json gains error-watch-disabled, which was thrown but never translated. The click also reads its level with String(), since Blaze can hand back a boxed String that `typeof x === 'string'` refuses. Thanks to xet7 ! |
||
|
|
32b61f186f |
Checklists: "Show on minicard" is an override, so unchecking it hides the checklist.
Reported by email with a screenshot (Swedish): "Även om jag avmarkerar 'Visa på minikort' (och vill dölja checklistan på minikortet)" - the switch is off and the checklist is on the minicard anyway. It was off for everybody. The minicard asked: board.allowsChecklistsOnMinicard || checklist.showChecklistAtMinicard and the board flag defaults to TRUE. An OR cannot be argued with: while the board setting is on, no value of the checklist's own field changes the answer. The popup made it look like a working switch - it drew the state from the raw field, which starts false, so it read OFF beside a checklist that was plainly showing, and clicking it wrote true and changed nothing visible. Clicking again wrote false and changed nothing either. Dead in both directions, which is exactly what the screenshot shows. The two settings are a DEFAULT and an OVERRIDE, not two ways of saying yes: showChecklistAtMinicard === true -> shown, whatever the board says showChecklistAtMinicard === false -> hidden, whatever the board says showChecklistAtMinicard undefined -> follow the board's default An override needs three states, so the field loses `defaultValue: false`: with every checklist born false, "hidden" and "not chosen" are the same value and the override cannot exist. models/lib/minicardChecklistVisibility.js is the one rule, used by the minicard, the popup's switch and the toggle - and the toggle now flips what is ON SCREEN rather than the raw field, because flipping the field is what made the first click do nothing. Checklists written under the old default carry a false that meant "follow the board". Left alone under the new reading it would mean "hide this one" and every checklist would vanish from every minicard - the mirror image of the bug. The schema-upgrade step checklist-minicard-unset clears exactly those, and it is the one step there that must run ONCE EVER rather than once per version: afterwards a stored false is somebody's choice, and re-running would put their checklists back. It keeps its own marker beside the schema-upgrade one for that. tests/minicardChecklistVisibility.test.cjs covers the reported case, the opposite one, that two clicks return to the board default, and that only true and false are opinions - a string, a number or a null from an old REST client or a bad import must not quietly mean "hide". tests/schemaUpgradeSteps.test.cjs gains the step, including the negative: after it has run, a false set by a person survives the next release. Verified by running both suites and the whole node suite (377 suites, 0 failed). Not verified in a browser: this sandbox has none. Thanks to xet7 ! |
||
|
|
bf047d53c8 |
Avatars: ask the request who it is, because Meteor.userId() cannot.
Following the same upgrade as #6583, profile pictures came back as broken images: "I can see Profile Pics from the user in the Admin/User Pannel if i open a User. But on the boards i see only the 'missing Picture' Icon" "initials are OK, but there is broken avatar image for those that have image" Nothing was lost, and the migration is not at fault. The avatar files migrate, and the Meteor-Files record made from a CollectionFS filerecord even reuses its _id (cfsRecordToMeteorFile), so a 6.x URL still names the right object. What broke is the request for it. A 6.x install stores profile.avatarUrl as /cfs/files/avatars/<id>. That route serves the legacy CollectionFS bytes if they are still there, and otherwise redirects to /cdn/storage/avatars/<id> - which asked who was asking like this: const userId = Meteor.userId(); if (!userId) { res.writeHead(401); ... } Meteor.userId() reads the current DDP invocation's environment. That exists inside a method or a publication and NOT in a WebApp handler, where it does not return "nobody" - it THROWS "Meteor.userId can only be invoked in method calls or publications". The handler wraps its body in a try/catch that answers 500, so the throw was swallowed into a broken image and no avatar served through that route ever reached anybody, on any install. The upgrade did not cause it; it moved every avatar URL onto the route where it already applied. server/routes/legacyAttachments.js had the identical call, so legacy attachment URLs failed the same way and for the same reason. Initials were unaffected because they are rendered client-side from the username and fetch nothing, which is why the report describes them as fine. The other half of the report - the Admin Panel showing a picture that a board did not - is NOT explained by this. Both templates end at the same route: peopleBody.jade puts profile.avatarUrl into an img src, and a board goes through +userAvatar, which appends ?boardId=. That parameter is the difference, and it has a cause of its own; the commit that follows this one deals with it. An HTTP request carries its identity in the request: a bearer token, an X-Auth-Token header, an ?authToken= parameter, or the login cookie - and on Sandstorm, a platform-injected user id and no Meteor token at all. server/routes/universalFileServer.js has always resolved it that way and serves attachments correctly today. server/lib/requestUser.js lifts that resolution out so the two routes that were guessing share it rather than grow a third copy, and so the next file route has something to call. It never throws: a caller deciding whether to serve a file wants an answer, not an exception its own catch will turn back into a 500. universalFileServer keeps its own inline copy for now. Rewiring a working file server is a separate change from fixing a broken one, and this commit should be readable as the fix. tests/requestUserAuth.test.cjs pins that neither route calls Meteor.userId(), that both await the resolver (an unawaited Promise is truthy and would authorise everybody), that all four token carriers and the Sandstorm path are handled, and that the migration still reuses the id the old URL names. Verified by reading and by the source guard; confirming the served image needs an upgraded instance, which this sandbox has no Docker to run. Thanks to markusst1982 and xet7 ! Fixes #6583, |
||
|
|
b4ebe48d7b |
WhereBleed: eight Admin Panel handlers ran the caller's selector unchecked.
GHSA-phm4-4v26-j2vq, CWE-943, CVSS 5.8. The Admin Panel's people, org, team and
translation publications and their companion count/page methods take a query
selector from the client and validate only its TYPE:
check(query, Match.OneOf(Object, null));
which is not validation, because a MongoDB selector is executable data. `$where`
makes the database run the caller's JavaScript once per document scanned, so
Meteor.subscribe('team', { $where: 'while(true){}' }, 25, 0)
pins a database worker for as long as the caller likes and is repeatable: denial
of service for every tenant on the instance, from one narrowly-scoped account.
The reporter demonstrated both halves on v10.81 against mongo:7 - `$where:
'sleep(2000) || true'` made the `people` subscription take 2.03s and return the
document, `$where: 'false'` returned nothing in 0.00s - which is the caller
deciding in JavaScript which documents come back.
It needs an authenticated admin session, so it is not reachable by a board member
or a visitor. It is still worth the fix at this severity because the people and
org surfaces are open to a PER-TENANT Global Admin, a role meant to be confined
to one Organization, and those two wrap the caller's selector as
`{ $and: [query, restriction] }` rather than stripping execution operators out of
it - so merging the tenant restriction never removed the `$where`, and a role
scoped to one tenant reached instance-wide impact.
WHAT MAKES THIS ONE PARTICULAR is that the defence was already here. classifySelector
(models/lib/injectionDetect.js) and hasWhere (models/lib/mongoSelectorSafety.js)
were written for exactly this class and were wired into the card-window
publication, with unit tests. Eight sibling handlers taking the identical shape of
client-supplied selector simply never called them. So this adds no new detection
logic: cardsWindow.js's own helper moves, unchanged, to
/server/lib/selectorGuard.js, and all nine call sites share the one copy. A second
copy of the check would be the same bug set up to happen again, which is why
cardsWindow.js now imports rather than keeps its own.
Each handler refuses with the "match nothing" selector that publication already
uses in production, `{ _id: { $in: [] } }` - frozen, so a caller cannot mutate the
shared object into one that matches - so a refused request returns an empty result
instead of throwing at an admin mid-page, and the canary still records who sent
what from where. Ordinary Admin Panel behaviour is untouched: none of the
searches, filters, regexes, $or/$and/$in/$elemMatch or date ranges those panes
send contains an execution operator, and the test pins fourteen real ones going
through unchanged.
FerretDB, WeKan's default database, rejects $where itself, so this degrades to a
rejected query there; the supported real-MongoDB path
(docker-compose-mongodb-v7.yml) is where it was reproduced. MongoDB 7 also happens
to reject $where inside the aggregation pipeline the four count methods use, but
that is an engine-level accident for one operator on one call path - $function and
$accumulator are legitimate aggregation operators - so the count methods are
guarded like the rest rather than left to it.
tests/selectorGuard.test.cjs pins the reported payloads (including nested inside
$and/$or, which is how the tenant merge would carry them), the other execution
operators, the fourteen ordinary queries, that all nine call sites route through
the guard, that none still passes the raw selector afterwards, and that exactly
one copy of the check exists. Three existing suites asserted the old shape -
canaryCoverage on where the canary trips, injectionDetect on the helper living in
cardsWindow.js, tenantWiring on the scope function receiving the raw query - and
each is updated to the new one, saying why.
Thanks to TungNGo02 and xet7 !
|
||
|
|
2cc0d42ddf |
Filesystem integrity: is that still the file WeKan stored, and did this server stop cleanly?
Attachments and avatars are files under WRITABLE_PATH, and the database holds one document per file. NOTHING checked that the two still agree. A file can be replaced, truncated, back-dated or deleted by anything that reaches the filesystem - a bad restore, a sync tool, a container rebuild, a shell on the volume - and WeKan would keep serving whatever is there now, silently. A baseline is recorded per file in the existing WeKan database (no new files under WRITABLE_PATH): path, size, modification time, and md5, sha256 AND sha512. Three digests, because they answer different questions. md5 is what other tools print, so an admin can compare against a backup with what they already have - it is never alone, its collision resistance is gone. sha256 is the working digest. sha512 earns its place on the day the two DISAGREE: two digests over the same bytes cannot, so when they do, the bytes were not read the same way twice - a failing disk, a partial write, a truncated copy - which is a different problem from a substitution and is its own critical finding. ed25519 is the fourth check and it is NOT a hash - it is a signature, and it answers the one thing three digests cannot: who says these are the right hashes? Anybody who can rewrite a file can rewrite a row of hashes. Each entry is signed over a canonical line (fixed field order, no JSON, whose escaping is not guaranteed stable) and verified on every scan. A record that does not match its signature is critical and is NEVER explained away by an ordinary edit. The key comes from WEKAN_INTEGRITY_PRIVATE_KEY, which WeKan never stores - that is the configuration that means something against an attacker who reaches the database too - or is generated and kept in the database, which detects filesystem-only tampering and is honest about being no more than that. A MALFORMED supplied key is reported rather than silently replaced by a generated one, which would look like it was working while checking nothing the operator meant. The scan is paced by policy, not by hope: once a day, checked hourly; nothing starts or continues at or above 60% CPU; 50 ms between files plus 20 ms per megabyte; a fifteen-minute budget, after which it stops and continues tomorrow; and ONE read per file for all three digests. A run that stopped early does not report the files it never reached as missing. The finding is a change WITH NO RECORD SAYING WHY. Files change when people use WeKan, and those changes are accounted for, reported once at info and re-baselined so they do not repeat daily. A change with nothing to explain it is at least medium and is deliberately NOT re-baselined, so it keeps showing until somebody looks. A modification time that moved BACKWARDS is called out separately: nothing does that by accident. Crashes and downtime, in the same stream, because a crash leaves nothing behind: the process is gone, so it cannot write a message about being gone. A heartbeat every minute is the only thing that works, and the NEXT start reads it. A first run and a clean stop record nothing - reporting every deliberate restart is how a Problems page becomes one nobody opens. A short gap with no clean-shutdown mark is a note; a long one is a high-severity "it stopped without shutting down cleanly, and here is how long it was down". Uncaught exceptions and unhandled rejections land here too, with their cause, before the process goes. Admin Panel / Problems / Filesystem integrity is the new stream, with the Username / IP address / Attempts columns. The baseline itself is never published and never client-writable: it is a map of every file on the server, and the key document is a private key. tests/fileIntegrity.test.cjs, 34 checks: every digest case including same-size substitution and disagreeing digests, the ed25519 forgery attempt, the canonical line, explained vs unexplained, and the pacing - including that an unreadable clock does not start a scan, which it did until the test said so. Thanks to xet7 ! |
||
|
|
d577f07700 |
Canary tokens: who tried to override permissions, and from where.
The security event log said what a guard DID - a request blocked, a filename
sanitized - which answers "is WeKan defending itself" and not the question an
admin asks next: who did that, and from where. It also could not tell a browser
that got confused from somebody working through the Hall of Fame one entry at a
time.
A CANARY is a tripwire at a point that only a permission-override attempt
reaches. Ordinary use never gets there - the code path runs when a request asks
for something the rules forbid - so a trip is not noise, and it is worth an
admin's attention with the actor attached. Design:
docs/Security/Remediation/WeKan.md §12.
Three properties, each enforced by a test:
SILENT. Tripping one changes NOTHING the caller can observe. tripCanary()
always returns false and tripCanaryDeny() always returns true, so a call site
reads as the refusal it replaces:
if (forbidden) return false; // before
if (forbidden) return tripCanary('card.vote-field', { userId });
The return value is decided before any reporting is attempted and the reporting
is wrapped, so a canary can never throw into, delay or disturb the request it
watches. The REST handler re-throws the ORIGINAL error object. This is not
politeness: a canary that announces itself is a map of which paths are watched,
and a probe would simply avoid them.
BOUNDED. A canary sits where an attacker can loop, so one row per attempt would
be a denial of service they get for free. models/lib/canaryTokens.js - pure, no
Meteor, no clock of its own - records the first trip of a (canary, actor) pair
at once, COUNTS the rest of the window, flushes one summary carrying the total
when the window closes, and stops writing after 60 summaries for a pair that
never gives up. The tracked-pair map is capped at 5000 and evicts the LEAST
RECENTLY seen, so a long-running attacker is not pushed out by a passing one and
a botnet varying its address cannot grow it. Idle pairs are swept on a timer. A
thousand attempts in a minute cost ONE row, and a suppressed trip costs one map
lookup. The username lookup is cached and capped, and neither it nor the insert
is awaited on the caller's path.
ATTRIBUTED. Every event carries userId, username, ip and count. The username is
denormalised at write time on purpose: it is what the account was CALLED when it
tried, so a rename does not rewrite history and a deletion does not erase it.
The address uses the same spoofing-safe resolver as the login throttle -
X-Forwarded-For only as far as HTTP_FORWARDED_COUNT says to trust it - or an
attacker could write a colleague's address into the security log by sending a
header. `detail` says what was attempted in the words of the feature, never the
payload.
Seventeen canaries are wired at the permission checks that refuse the attempts
behind BoardBleed, ParentBleed, ChecklistBleed, PathBleed and CommentBleed, plus
the direct vote/poker field writes and a stored path that points outside the
storage root. All server-side: no Playwright, no browser, nothing to install.
Admin Panel / Problems / Security gains Username, IP address and Attempts
columns, and both new columns are searchable - the thing an admin does with one
security event is pivot on it.
tests/canaryTokens.test.cjs (25 checks) drives the limiter through bursts, an
endless probe, eviction order and junk input; tests/canaryCoverage.test.cjs (18)
pins every canary to its call site and asserts none of them changes what the
caller gets back.
Thanks to xet7 !
|
||
|
|
a4a9c03b1f |
Security tests: say which vulnerability you guard, and check the list.
"Are the security tests enough to prevent what is in the Hall of Fame" was unanswerable. WeKan publishes 58 named vulnerabilities at https://wekan.fi/hall-of-fame/ ; some suites name the one they belong to, most did not, and the Hall of Fame lives in a different repository that CI never checks out. Answering it meant reading 58 pages against 300 suites by hand, which means it was never answered - and a regression test that quietly stops existing is worth nothing, the failure mode tests/testsAreRegistered.test.cjs already caught once when two *bleed suites drifted out of the mocha index. So the list lives in the repository that has the tests, and tests/securityRegressionCoverage.test.cjs keeps the two in step. Every published vulnerability is either GUARDED - named by a suite that still exists - or RECORDED, a gap with a written reason, which is the CHANGELOG's "TODO Later" pattern applied to tests. The gap count is pinned, so a vulnerability cannot be published with neither a test nor a note; a gap that turns out to be guarded after all fails too, so coverage is never understated; and a file that merely REGISTERS suites is not accepted as coverage, or the guard would pass itself. Getting there meant naming vulnerabilities in the suites that already guarded them, which is most of what this commit is: - tests/securityMeifukun.test.cjs guards eight reports and named one. Its sections are RedirectBleed, SourceBleed, LiveBleed, CasBleed, OidcBleed, MetricsBleed, ImpersonateBleed and InviteBleed - seven vulnerabilities that looked untested and were not. - tests/noIdentityReplacement.test.cjs guards IdentityBleed and PatternBleed, the same CodeQL finding twice. - ExportBleed, CrashBleed, MimeBleed and the four LockoutBleed suites now say so. - tests/crossBoardParentCardLeak.test.cjs also guards BoardBleed's cross-board move deny, and now checks it on Lists and Swimlanes too, not only Cards. The count that comes out of it: 29 of 58 published vulnerabilities have a named regression test, and 29 are recorded gaps - mostly older fixes from before WeKan tested its security fixes at all. They are not known to be unprotected; they are known to be unchecked, which is a different and more honest statement, and each one now says what it would take to close it. Thanks to xet7 ! |
||
|
|
35daaaa279 |
ParentBleed: one card id bridged a private board into another board's feed.
A card's `parentId` may name a card on ANOTHER board, and setting it was authorized only against the CHILD board's write ACL - nothing asked whether the person setting it, or the people subscribed to the child board, were allowed to see the other board at all. The board publication walks the whole ancestor chain, because the 'prefix-with-full-path' subtask setting renders a subtask's complete path (#3453), and it published the complete ancestor card DOCUMENTS to every subscriber of the child board. So a member who could write on shared board B and knew a card id on private board A could point a card at it and have A's card - title, description, custom fields - delivered over DDP to people who are not members of A (CWE-200, CWE-862). Closed at both ends, because either alone leaves half the hole open. The WRITE refuses a parent whose board the actor cannot see. That is one question, asked in one place (server/lib/visibleBoardIds.js) with the same selectors the publication and All Boards use - so an ACTIVE org, team or domain share counts and a revoked one does not. It is enforced on the REST card create, on the REST card update (the PUT the report used), and on DDP by a deny rule covering both insert and update, beside the cross-board MOVE deny that GHSA-gm7v-pc38-53jr added. A parent that does not exist is refused too. Clearing or omitting a parent is untouched. The PUBLICATION sends only the ancestors whose board the subscriber may see. The board being published is its own answer, so a normal same-board subtask path is unchanged; an ancestor on a board the subscriber cannot see is simply not sent, and a chain that yields nothing publishes nothing. This is the shape of the check the linked-card path already made - creating a linked card requires read access to the source card's board - applied to the field that did not have it. tests/crossBoardParentCardLeak.test.cjs pins the filtered cursor, that the unfiltered publish of every ancestor is gone, that both REST paths validate before writing, that the deny rule covers insert as well as update, and that clearing a parent and the pre-existing cross-board move deny still work. Thanks to Alpastx and xet7 ! Fixes GHSA-jvv9-498p-hxrg. |
||
|
|
5548029088 |
The five failures the .tools move and the card-move fix left behind.
An EVERYTHING run found four node suites and one mocha test failing. All five
are consequences of the two changes before them, and each one is a guard doing
its job.
Three broke on the companion-repo move:
* meteorignoreScanScope listed the foreign checkouts by name - FerretDB, node,
mongo-tools, TSC, gitea, the two WeKan variants - one .meteorignore entry
each. They are in .tools/ now, one entry that covers all of them, so a list
of names is a list of history: it fails for the ones that moved and says
nothing about the next repo somebody clones. It asks the property instead:
.tools is excluded, and nothing at the top of this checkout that is its own
git repository is left for Meteor to walk. The variant check became the
stronger version of itself - no directory with client/, server/ and models/
is reachable from the top - since a second WeKan is loaded EAGERLY, not
merely scanned.
* swcLegacyHelpers checked .gitignore for the same list; one entry now.
* cpuMonitorWiring reads FerretDB's Go source and still opened FerretDB/. It
reads .tools/FerretDB, and skips with a note when the clone is not there -
it is a separate repository, and not every checkout has cloned it.
dockerComposeBackends caught a real omission: the LDAP_GROUP_BASEDN block from
#5539 went into docker-compose.yml only, and every compose file's wekan service
must be identical - what a user reads when they edit their settings must not
depend on which backend they picked. The block is in all of them now.
The mocha failure is the one worth reading twice.
cards.dependencies.move.tests.js pinned move() issuing the inbound-dependency
cleanup itself: a multi-document update with a compound selector. That is
exactly what #6572 removed, because this helper runs in the client bundle where
Meteor allows updates only by id - it threw "Untrusted code may only updateAsync
documents by ID" on every cross-board move, before the move ran. So the test was
pinning the bug. It now asserts the contract that replaced it: move() clears the
moved card's own dependencies, and makes NO update that is not by id - not a
selector, not multi. `{ _id: x }` still counts as by id, since Meteor's rule is
"by id", not "not an object". The inbound half is the server hook, pinned by
tests/cardMoveUntrustedUpdate.test.cjs.
Verified against the tree: all four node suites' conditions hold, the four
compose files the guard compares are identical again, and the FerretDB source
the CPU guard reads is present at the new path with every pattern it asserts.
Thanks to xet7 !
|
||
|
|
ee16a41a99 |
Board export: pin every section, and fix the mocha stage that stopped running.
The newest test run had two failures. tests/changelogFormat.test.cjs failed on "the binaries table follows the summary": the Upcoming section written after v10.71 had lost the binaries table that every release section carries. It is restored from what v10.71 shipped, and two group lines that had wrapped onto a second line are one line again, which is what the grouping guard requires. The mocha stage did not run at all. client/lib/tests/boardTriggersClass.tests.js reads boardTriggers.jade and boardTriggers.js off disk with fs and path, which worked only while node-polyfill-webpack-plugin's browser shims were in the client bundle; the @meteorjs/rspack 2.1.0 update dropped that plugin and the client build stopped with "Cannot find module 'path' for matched aliased key 'path'". That is not one suite failing - the bundle does not build, so every mocha suite is skipped and the stage reports a crash where its results should be. The suite was on the wrong side rather than wrong: it now lives in server/lib/tests, and tests/clientTestsNoNodeBuiltins.test.cjs is the mirror of the existing guard that keeps browser-only packages out of the server bundle. Issue #6274, "export includes only comments from current year", and its fix in PR #6275 were then checked against the current source. The fix is intact and survived the streaming-export rewrite that came after it: both exporters select comments by cardId and activities by boardId OR cardId. The follow-up its reporter left on that PR - "the export is now missing the lists part" - is not reproducible: result.lists has been written by the JSON exporter continuously since the CSV/TSV export was added, both JSON writers emit the same fourteen sections, and the flat formats carry each list's name on the card's own row. So no export code changed; what was missing was the guard, and tests/exportBoardSections.test.cjs pins the section list, that the two JSON writers agree on it, that no exporter selects comments by board again, and the two smaller fixes from that PR. Not run here: this sandbox has no node, meteor or any other JS runtime, so the new and changed guards were verified by porting them assertion-for-assertion to Python and running that against the same files - changelogFormat 16/16, the export and client-bundle guards clean. The mocha suites behind the fixed build have not executed yet; the next run is what shows them. Thanks to Tuphal, KhaoulaMaleh and xet7 ! |
||
|
|
c3742f2ed7 |
Fix LockoutBleed: user enumeration and unthrottled password brute-force.
GHSA-2g94-9x3m-hv37. Two verified weaknesses on the login path chained into
account takeover, and both are fixed here.
1. The bundled wekan-accounts-lockout brute-force protection was completely
inert. Its two Accounts.validateLoginAttempt hooks decided whether an attempt
failed by comparing the error's reason string ('Incorrect password' /
'User not found'), but Meteor's accounts-base ships ambiguousErrorMessages
defaulting to true, so _handleError rewrites every credential failure to
"Something went wrong. Please check your credentials." before those hooks run.
The literals never matched, both hooks returned early, the failure counter
was never incremented, and no account ever locked. The hooks now decide from
the attempt's structural fields (new loginFailureDecision.js): any genuine
password failure counts, while the benign 'no-2fa-code' step (password already
correct, second factor still to come) never counts, so 2FA users are not
locked out of their own sign-in.
2. The login path leaked which accounts exist by timing: a real user runs bcrypt
(~50 ms) while a missing one returns in ~2 ms. A dummy bcrypt comparison
against a fixed cost-10 hash (loginTimingDefense.js) equalises the missing-user
path on the DDP login method (loginTimingNormalization.js, a handler that runs
ahead of the built-in one and never authenticates) and on the REST endpoint.
The REST POST /users/login twin also enumerated by message (a distinct
"...not found." string) and never ran the lockout hooks at all. It now fails
missing-user and wrong-password identically, runs the timing equaliser, and
throttles failed attempts per client address (loginAttemptThrottle.js), keyed
safely behind HTTP_FORWARDED_COUNT, resetting on success.
Tests: loginFailureDecision, loginTimingDefense, loginAttemptThrottle and
loginBruteForceEnumerationWiring (four new plain-Node suites).
Thanks to NinjaGPT and xet7 !
Fixes GHSA-2g94-9x3m-hv37.
|
||
|
|
aab81e8ffd |
Make the DnsBleed response stub a real stream, like IncomingMessage is.
Seven of the DnsBleed mocha tests failed with "Timeout of 2000ms exceeded" -
every one of the ALLOW cases, while every block case passed, which is what
hid it.
The stub was at fault, not fetchSafe. It faked http.IncomingMessage with a
bare EventEmitter that emitted 'data' and 'end' from a process.nextTick,
into the void if nothing was listening yet. No real response does that: an
IncomingMessage is a PAUSED Readable that buffers its body until a listener
attaches or it is resumed, so reading late cannot lose data.
That only started to matter when fetchSafe was split into resolving the
response and then reading it, which the redirect handling needs - it has to
see the status before deciding whether to read a body at all. The nextTick
queue drains BEFORE promise microtasks, so the fake had already fired 'end'
by the time the awaited continuation attached its listeners.
Verified rather than assumed, both halves:
- against a real server: a request whose 'data' listener is attached two
nextTicks, a setImmediate and 20ms after the response callback still
receives the whole body.
- against the real fetchSafe, driven by each stub in turn: the old
EventEmitter stub times out after 2s; the Readable-backed one returns
status=200, the body, the pinned IP 93.184.216.34 and Host
example.com.
The security assertions still hold through the new stub, checked the same
way: a 302 with the default maxRedirects:0 is refused, a host resolving to
127.0.0.1 is refused with ZERO requests sent, a followed redirect pins each
hop to its own resolved IP, the abandoned hop reports destroyed=true, and
Authorization and Cookie are dropped on the cross-origin hop.
destroy()/destroyed are now the stream's own rather than a hand-rolled flag,
so "fetchSafe abandoned this body" is asserted against real stream
behaviour.
Thanks to xet7 !
|
||
|
|
4c183b4d59 |
GHSA-j9p2-jm73-p549 and GHSA-c5xr-mg26-vq5w: two ways past the SSRF guard.
Two separately reported bypasses of the same defence, fixed together because they are the same mistake in the two halves of it: the guard decided from something it did not control. FollowBleed (GHSA-j9p2-jm73-p549, reported by RandomGenerator against v10.53) - the live Trello import validated the attachment URL with validateAttachmentUrl(), which is the fix that closed LiveBleed / CVE-2026-30844, and then downloaded it with the platform fetch(), which FOLLOWS REDIRECTS. So the guard only ever saw the request, and the target gets to answer: 1. the attacker puts http://<public-host>/attachment.txt on a Trello card 2. validateAttachmentUrl() resolves it, sees a public IP, allows it 3. that host answers 302 Location: http://127.0.0.1:18080/secret 4. fetch() follows, and the loopback body is stored as the imported attachment, readable back through WeKan Non-blind SSRF against loopback services, internal admin panels, cloud metadata and anything else reachable from the container - the exact thing the validation was added to stop, reached through the response instead of the request. A guard on the URL alone cannot hold, so fetchSafe() now guards EVERY HOP. `maxRedirects` (default 0) is how many redirects a caller is willing to follow: 0 keeps the old behaviour of refusing any 3xx outright, which is right for outgoing webhooks and avatar downloads because a legitimate one never redirects. A caller that must follow one passes a small number, and each hop goes through the same protocol allowlist, blocked-range check and DNS pinning as the original URL before a packet is sent to it. Credentials are dropped on a cross-origin redirect, so following Trello's 302 to S3 cannot hand the API key and token to whoever the redirect names. All three live-import sinks - downloadAttachmentBase64, inlineBoardBackground, inlineMemberAvatars - download through it. Refusing every redirect was not an option: Trello's own attachment endpoint answers with a 302 to a signed S3 URL, so that would have meant importing no attachments at all. The offline importers had the same hole and were not in the report. They handed the validated URL to Attachments.loadAsync(), and Meteor-Files downloads with the platform fetch() too, so a pasted Trello or WeKan board export reached 127.0.0.1 by exactly the same 302. models/lib/importAttachmentDownload.js validates, downloads through fetchSafe with every hop checked, and hands back the bytes, which are stored with the writeAsync() both importers already use for an attachment that arrived inline. TransitBleed (GHSA-c5xr-mg26-vq5w, reported by tonghuaroot) - isIpBlocked() in models/lib/attachmentUrlValidation.js is the one block-list behind BOTH the input-time validator and the delivery-time guard, and its IPv6 half classified an address by its spelling: startsWith('::ffff:'), startsWith('2001:db8'), and the first hextet parsed out of the string. IPv6 has several standard ways to write "this packet goes to an IPv4 address" and none of them looks like `::ffff:`: 2002:a9fe:a9fe:: 6to4 (RFC 3056) -> 169.254.169.254 64:ff9b::c0a8:101 NAT64 (RFC 6052) -> 192.168.1.1 2001:0:... Teredo (RFC 4380) -> complement of the low 32 bits 0:0:0:0:0:ffff:7f00:1 IPv4-mapped, spelled out -> 127.0.0.1 On a host with a 6to4 relay or a NAT64 gateway, which is ordinary in cloud and Kubernetes networks, the packet arrives at that IPv4 address. So http://[2002:a9fe:a9fe::]/latest/meta-data/ read cloud metadata straight through the guard whose whole job was to stop it, and even a plain IPv4-mapped address written out in full missed the check. The address is EXPANDED to its 16 bytes once and every check reads those bytes, so notation cannot change the answer, and every transition form has its embedded IPv4 extracted and re-checked with the IPv4 rules - 6to4, NAT64 (well-known and RFC 8215 local-use prefixes), Teredo through both its server and its obfuscated client address, IPv4-mapped, IPv4-translated, IPv4-compatible and ISATAP under any routing prefix, not only the link-local one. The deprecated fec0::/10 site-local range is blocked too. A transition address wrapping a PUBLIC IPv4 is still allowed, because a guard that blocks everything gets switched off. Tests. tests/followbleed.test.cjs replays the reported attack against a stubbed transport - a public host that 302s to 127.0.0.1 - and asserts the second hop is never sent, then covers redirects to a hostname resolving to a private IP, to metadata, to a non-http scheme, relative Location, the chain limit, credential stripping across origins, 303/307 method handling, and that a legitimate public-to-public redirect is still followed with each hop pinned. It also pins the sinks: the only bare fetch() left in the live import is the hardcoded api.trello.com call, and neither offline importer uses loadAsync any more. tests/transitbleed.test.cjs checks every transition form in both directions. Both are in the plain-node suite; the guard's own dnsbleed suite gained the same cases. 300 node suites pass. Thanks to RandomGenerator and tonghuaroot for the coordinated disclosures, and xet7 ! |
||
|
|
2790fe5092 |
Fix the 19 tests my header and menu restructuring broke.
The newest run (../log/2026-08-01_03-14-39) is the first since this work: 18 Playwright failures in every one of the three browsers, and one mocha failure. The run before it had none. All of them are mine, and all of them are tests describing markup I moved rather than behaviour that broke. .js-toggle-sidebar was eight of them. The hamburger moved to the first header bar and became .js-toggle-page-sidebar - one control that opens whichever sidebar the page has. The page object and the one spec that named it directly now name the new one. Its handlers in boardHeader.js and sidebar.js are DELETED rather than left: markup for them no longer exists anywhere, so they were dead code that reads as a working feature, and the injected CSS rule in boardBody.js is repointed at the class that exists. #header-main-bar was two: the RTL layout test used the second header bar as its "the page has visible text" anchor, and the three list pages it checks no longer render one. It anchors on the first bar's page title instead, which is where those titles went. The rules controls were three: they are a view of the shared page sidebar now, so the specs open it first. The All Boards search field was one, for the same reason. The card's copy-link button was two - it is a row of the card's actions menu, so the page object opens the menu, and the test asserts what reached the CLIPBOARD rather than reading an href that no longer exists. That clipboard is RECORDED, not read back: reading it needs a clipboard-read permission only Chromium can be granted, so a test that read it would pass on one browser of three. WeKan copies through navigator.clipboard.writeText, so wrapping that captures the real value everywhere - and it is a stronger check than the old test, which accepted "no href, so click it and see that nothing threw" and would have passed even if the button copied nothing. Two were addresses: /templates now redirects to /allboards/templates, and the admin spec navigated to /admin-reports and then clicked a menu row. Every Admin Panel pane has an address of its own, so it goes straight to /admin/problems/files - no redirect to race with the menu rendering. The mocha failure is from the board-roles capability table: allowIsBoardMemberCommentOnly asks that table now, and the table reads board.members, while the test's stub offered only the old hasMember/hasReadOnly methods - so it answered false for everyone. The stub is a members array now, and a second case pins what the old one could not express: it is the ROLE that decides, not membership, so isNoComments, isReadOnly and an inactive member are each false. Every expectation was checked against the real function before being written down. Not verified by running: Playwright needs the app server and browsers, which this sandbox does not have. Every edited file parses, and the 292 node suites pass. Thanks to xet7 ! |
||
|
|
efa534fddf |
Board roles: one capability table, three roles fixed, and a Roles Status pane that shows it.
What each role may do was spelled out THREE times - in the server allow helpers,
in the client's canModify* helpers, and in prose in the docs - and the three had
drifted apart. Every place they disagreed was a role that did not do what its name
says. models/lib/boardRoleCapabilities.js is that table now, in code, and
everything reads it: the allow rules, the UI helpers, the new Admin Panel pane and
the documentation. There is nowhere left for a fourth opinion to appear.
THE THREE GAPS, fixed:
* "Comment only, assigned" (isCommentAssignedOnly) had FULL WRITE ACCESS.
Nothing outside the card publications read that flag and it was not in the
write rule, so the role could create and edit cards, lists and checklists - it
was "Normal, assigned only" under another name. It is comment-only now, like
the role it is named after; the two differ only in what they see.
* "No comments" (isNoComments) could not write ANYTHING. The write rule excluded
it, so the role blocked editing as well as commenting - a second read-only
role under a name that says otherwise, and one the UI still offered the edit
buttons for. It blocks commenting only now, which is what the name and the
board schema both say it is for.
* The write rule did not exempt board admins. Every has*() helper on the board
ignores a flag on an admin; that one read the raw flags, so an admin who also
carried isNoComments silently lost write access. Not reachable from the Web
UI, which writes all eight flags at once, but reachable over the REST API,
which takes them individually. memberRoleOf() resolves isAdmin first.
The UI helpers were part of the same drift - canModifyCard() did not exclude
isNoComments while the server did, and canModifyBoard() excluded neither
isNoComments nor isWorker - so each disagreement was a button offered to somebody
whose write the server then refused. All three ask the same table now.
A FOURTH gap found while building the table, NOT fixed: a Worker cannot move a
card, which is the one thing the role is for. Moving a card is a card UPDATE, so
it goes through the write rule, which excludes Worker. The fix is not a table
edit - it means letting a role write SOME fields of a card and not others, and
"assign himself" means validating that a member change only ever adds the caller.
That is a field-level policy on the path every card update takes and wants
deciding on purpose. It is recorded under "Known gaps" with what it would take.
ROLES STATUS, at Admin Panel / People / Roles, below the Save button: a READ-ONLY
table of what each role may do - which cards it sees, and whether it may comment,
create and edit, or change the board's settings. It is the shared table page
(docs/Design/Page/Table.md), so it looks and behaves like every other Admin Panel
table, with no markup of its own; it has no rowTemplate, no actions and no
editable cell, because a role's capabilities are a property of the code and not a
setting. Every string is a translation key, the Yes/No of each cell included - the
values are booleans, and a hard-coded "Yes" would be English in every language.
The "Invite to board" column reads the pane's WORKING copy, so the table follows
the checkboxes above the Save button as they are ticked, before saving, which is
the point of putting it there.
docs/Design/Page/Table.md listed Roles among the panes that do NOT use the shared
design, "so the gap is visible rather than forgotten" - it has a table now, so it
moved to the list of pages that use it, and the exclusion covers the two panes
that are still nothing but a form.
Two guards were checking the shape of the old code rather than what it guaranteed,
and are updated with the reason in the test: listDragPermission read the flag
exclusions out of canModifyBoard's own body (it has none now, so it checks the
BEHAVIOUR - anonymous is falsy, and each excluded role still cannot drag a list),
and tablePage counted the pager handlers file-wide, which also forbade a handler
on a different template - a separate event map is not a duplicate key.
tests/boardRoles.test.cjs is the suite: the module itself including each fixed
gap, that the server rules and the UI helpers ARE the table and name no flag
themselves, that every cell of the documentation matches it, that the
assigned-only column matches the publication scope, that the remaining gap is
still real and the three fixed ones are recorded as fixed, and that the Roles
Status pane renders from the table, is read-only, is the shared template, follows
the working copy, and translates every string it shows.
Thanks to xet7 !
|
||
|
|
fe27dc0b8e |
Fix #6560: moving a card to another board blanked every custom field id.
The values survived the move; their keys did not. Each entry came out with
`_id: ""`, which no board can match to a field definition, so the card arrived on
the destination board with every custom field showing empty. Drag-and-drop, the
Move card popup and the REST API `newBoardId` move all go through
Cards.helpers.move(), and Cards.helpers.copy() had it too.
`mapCustomFieldsToBoard()` was SYNCHRONOUS and called
`ReactiveCache.getCustomField()`, which is async on the SERVER - it awaits
findOneAsync - and synchronous only on the client. So on the server both lookups
returned Promises. A Promise is truthy, so `if (!oldCf)` never fired and the
`if (newCf)` branch always did, assigning `newCf._id`: `undefined` on a Promise.
The schema declares `customFields.$._id` as `optional: true, defaultValue: ''`, so
collection2 cleaned that undefined to `''` on the way to the database. Nothing
threw and nothing was logged.
Both lookups are awaited now, and so is `oldCf.addBoard(boardId)` - also async,
and until the two above were awaited its branch was unreachable, so its own
missing await had never been exercised.
Two things found while fixing it, in the same function:
* The entries are rebuilt rather than mutated. copy() deliberately works on a
shallow copy of the card "to avoid mutating the source card in ReactiveCache",
and `cf._id = newCf._id` reached straight through that copy into the source
card's own entry objects - re-keying the card being copied FROM.
* An entry with no id is passed through instead of looked up.
getCustomField() defaults its selector to `{}`, so `getCustomField(undefined)`
returns an ARBITRARY custom field, and a blank entry - including one blanked
by this very bug - would have been re-keyed to whichever field came first.
This is the same defect as #6504 (unawaited ReactiveCache.getBoard in this same
cross-board branch of move(), which gave "newBoard.getNextCardNumber is not a
function"), one line further down. The guard added then named the two getBoard
calls and stopped there, so the third call shipped broken for twenty more
releases; tests/cardMoveAwaitBoard.test.cjs now checks the branch as a whole and
fails on any unawaited async call in it - verified against the pre-fix file, where
it reports mapCustomFieldsToBoard.
tests/cardCustomFieldsMove.test.cjs lifts the real function out of models/cards.js
and runs it against both worlds - an async ReactiveCache (the server, where this
broke) and a synchronous one (the client, where it always worked) - which must
give the same answer: a value whose field exists on the destination board by name
and type is re-keyed to that board's definition, and one whose field does not is
left pointing at the definition it had, which gains the destination board so the
value still resolves. It also pins that addBoard is finished before the array is
returned, that an unknown field id costs no value, that a blank entry is never
matched against an arbitrary field, that the source card keeps its own ids, and
that both call sites await.
Cards moved or copied between boards on an affected release are NOT repaired by
this: the entry kept its value but lost the only reference to which field it
belonged to, so there is nothing left to match it back with. Those values have to
be set again.
Thanks to ChristianMa97 and xet7 !
Fixes #6560,
|
||
|
|
ca0e36e371 |
Database problems: show what the database actually said.
A database problem arrived in Admin Panel / Problems / Database problems with an empty Category, Name and Action, a severity of warning, and a detail that said "The database returned an error WeKan has no rule for. Read the message below" - with no message anywhere below, or above, or on the page at all. So the row said that something happened and nothing about what. Nothing was wrong with the classifier or the recorder. EventLog has a SimpleSchema attached, and collection2 cleans every insert against it with filter:true, so a field the schema does not declare is dropped silently on the way to the database. The four fields the database stream uses - type (the rule id), db (which database said it), kind and message - were never added to that schema, so they were the four things thrown away, and they are exactly the four the page shows in Category, Name, Action and the message it told the admin to read. The other four streams were unaffected because they only ever write schema fields. The schema declares them now, and a test pins the general rule instead of the one instance: for each of the five event loggers, every key of the document it inserts must be declared in the EventLog schema, so the next field somebody adds to a logger cannot vanish the same way. The message is shown too - the Detail cell carries WeKan's reading of the error and then the database's own sentence, which is the one thing an admin can search for or paste into an issue - and the stream search looks at message, db, kind and type, so searching for "postgresql" or for a phrase out of the message finds the row that displays it. The unclassified advice no longer promises a message "below": the message follows in the same cell. Because that message is now stored and displayed, it loses its credentials first. A database that refuses a login or cannot be reached quotes the connection URL back, password and all - "failed to connect to mongodb://wekan:s3cret@mongo:27017" - so classifyDatabaseError redacts the userinfo of any URL in the message before returning it, keeping the host, the port and the database name, which are what makes the message useful. It is done there rather than in the recorder so no future caller can forget it. The message is also sanitized like every other stream's detail: one line, control characters out, capped. Thanks to xet7 ! |
||
|
|
032722fcc4 |
Security: trust a certificate instead of disabling verification, and escape every metacharacter.
CodeQL alert #430, js/disabling-certificate-validation, High: `reqOptions.rejectUnauthorized = false` in the outgoing-webhook path. It is right, and the switch is gone. `rejectUnauthorized: false` accepts ANY certificate - including the one a man in the middle presents - which is the attack the handshake exists to stop. What #6553 and #6551 actually need is not "verify nothing", it is "this certificate is legitimate", so that is what WeKan takes now: WEBHOOK_TLS_CA_CERT the certificate (or CA) to TRUST for outgoing webhooks MAIL_TLS_CA_CERT the same for the mail server MAIL_TLS_SERVERNAME the name to verify the mail certificate AGAINST, for the wildcard-one-level-short case the report describes Each is the PEM itself or a path to a file holding it. A self-signed certificate is its own issuer, so naming it here is exactly what makes it valid - and verification stays ON, the chain is still checked, the hostname is still checked. A path that cannot be read is not fatal: it logs which setting failed and keeps the system trust store, rather than stopping mail or webhooks. The SSRF protections are untouched: the address is still resolved once and pinned, private ranges are still refused, redirects are still blocked. CodeQL alert #429, js/incomplete-sanitization, High: `helper.replace(/\./g, '\\.')` in a test escaped dots only, so a backslash in the value could change the meaning of the pattern it was spliced into. It uses the same escape-everything helper tests/testsAreRegistered.test.cjs already has, with the backslash escaped FIRST. tests/mailTransportTls.test.cjs now fails if `rejectUnauthorized: false`, that same assignment, or NODE_TLS_REJECT_UNAUTHORIZED appears in either file - so the pattern cannot come back quietly - and covers the certificate-from-PEM, certificate-from-path and unreadable-path cases. Thanks to GitHub CodeQL code scanning and xet7 ! |
||
|
|
98bce97141 |
Fix #6545 OAuth2 scopes, #6546/#6555 bind IP, #6550 IPv6 database, #6551/#6553 TLS verification.
#6545 - a Keycloak login opened the popup and closed it immediately. The snap's default for OAUTH2_REQUEST_PERMISSIONS was "'openid profile email'" - the single quotes are part of the VALUE - so the scope sent to the provider was `'openid` … `email'`, which no provider knows and a strict one refuses outright. The default has no quotes now, and WeKan normalises the value anyway (models/lib/oauth2Scopes.js: strips surrounding quotes, accepts commas or spaces, drops duplicates), so an install still carrying the old value keeps working without anyone noticing the difference. #6546 / #6555 - there was a mongodb-bind-ip but no way to say where WeKan itself should listen, so it was always Meteor's default of 0.0.0.0 and IPv6 was unreachable. `snap set wekan bind-ip='::'` listens on IPv6 (and on IPv4 through it on a dual-stack host); empty keeps today's behaviour exactly. #6550 - an IPv6 database could not be reached at all: the snap built `mongodb://$MONGODB_BIND_IP:$PORT/wekan`, and an IPv6 LITERAL has to be bracketed - `mongodb://::1:27019/` is not a URL and the driver refuses it. The address is bracketed when it contains a colon, which no hostname and no IPv4 address does; the readiness probe builds its URI the same way, so it can no longer wait forever on a URL that cannot be parsed. #6551 - a mail server whose certificate does not match the name it is reached by ("Hostname/IP doesn't match certificate's altnames" - a wildcard one level too short, an internal CA) could not be used at all, because Meteor builds its transport from MAIL_URL with no say in it. MAIL_TLS_REJECT_UNAUTHORIZED=false installs a transport that connects anyway. #6553 - the same for an outgoing webhook to a server with a self-signed certificate: WEBHOOK_TLS_REJECT_UNAUTHORIZED=false. Both are OFF by default, both are per-purpose, and neither is NODE_TLS_REJECT_UNAUTHORIZED, which would drop certificate checking for everything the server connects to. The webhook switch changes nothing else: the connection is still pinned to the resolved address and private ranges are still refused, so the SSRF protection is untouched - what is given up is only the proof of who is on the other end, for the one endpoint the operator chose. tests/mailTransportTls.test.cjs covers the SMTP option building (ports, smtps, credentials with encoded characters), that only the exact string "false" turns verification off, that nothing is installed unless it is asked for, and that neither file reaches for the global switch. Thanks to lukasjelonek, sysblade, scoopex, 1977er, GuiGuiSoft, marioschulz93 and xet7 ! Fixes #6545, Fixes #6546, Fixes #6550, Fixes #6551, Fixes #6553, Fixes #6555. |
||
|
|
3a5b228797 |
Fix #6533: a busy SQLite must not cost the boot, and the boot must not keep it busy.
The reporter's snap, upgraded from 6.09 to 10.44, was in a systemd restart loop at restart 72, with 8 CPUs at load 7 and SQLITE_BUSY everywhere: error on boot.js Error [ValidationError]: Failed validation [msg_update.go:133 ...] [collection.go:191 sqlite.(*collection).UpdateAll] database is locked (5) (SQLITE_BUSY) Two things here, each of which made the other worse. (The third, in the FerretDB fork, is the `_txlock=immediate` default that lets the busy handler cover a contended write at all.) 1. A TRANSIENT DATABASE ERROR ENDED THE BOOT. Meteor's boot.js exits the process when a startup callback rejects, systemd restarts it, and the restart re-runs the same startup work against a database that is busy because the previous boot was doing it. SQLITE_BUSY means another writer had the lock - nothing is wrong with the data - so server/00startupResilience.js wraps every startup callback: a transient database error (the shared classifier's deadlock / too-many-connections / connection-lost / timeout) is logged, recorded for Admin Panel / Problems, and swallowed, and the step runs again next start. Anything else - a full disk, a refused login, a syntax error - is rethrown, so a real fault still stops WeKan. 2. THE BOARD-ID BACKFILL SCANNED EVERY CARD ON EVERY BOOT. It streamed the whole Cards collection and issued one multi-update per card - 130,947 of them here, for each of two collections - and its "anything left to do?" guard could never go quiet, because a checklist whose card was deleted has no board id to copy and stays missing one forever. It is driven by the rows that are MISSING the board id now (normally none), collects their distinct card ids in bounded chunks, and asks Cards only for those. What cannot be filled from a card is counted and reported once. The pass is version-gated like the schema upgrade beside it, so an unchanged version costs one findOne. tests/sqliteBusyResilience.test.cjs pins both, including that SQLITE_BUSY classifies as retryable contention while a full disk does not. Thanks to Nissulya and xet7 ! Fixes #6533, |
||
|
|
21300f5cb4 |
Say which database has which problem, in Admin Panel / Problems.
WeKan runs on MongoDB or on FerretDB v1 over SQLite, PostgreSQL, MySQL, MariaDB or SAP HANA, and each answers a broken query, a full disk or a refused login in its own words. Those words reached an admin as an opaque string: "Error 1064 (42000): You have an error in your SQL syntax" with no way to know which database said it, that it is FerretDB's bug rather than their data, and that upgrading FerretDB is the fix. models/lib/databaseErrors.js is the translation - pure, so it is unit-tested without a database: a message in, and out comes which database said it, what kind of problem it is, what it means, what the admin should do, and whether WeKan can do anything itself. Sixteen rules, every one of them a message a real database produced in the conformance runs or the documented wording of the condition: injection refused by FerretDB's SQL guard, the syntax errors of all four dialects, the two permission failures that stopped MySQL and MariaDB dead this week, authentication, disk full, connection limits, deadlocks (retried), lost connections (reconnected), timeouts, duplicate keys (which is an index doing its job, not a problem), unimplemented operations, and a handler the binary was not built with. server/lib/databaseProblems.js records them into a new `database` event stream, one per problem per minute - a database that is down answers every query - and watches Meteor._debug, which is where a database error surfaces without wrapping every call site in the app. Admin Panel / Problems has the pane, and its first column is the database that said it. Thanks to xet7 ! |
||
|
|
1f4bf0be13 |
Migrated images show in the card view again.
Reported after upgrading from WeKan 6 to 10.37/38/40: an attached image is
visible in board view, downloads correctly from the card, and yet the card view
shows an empty white box that cannot be maximized. Cards created AFTER the
upgrade are fine.
The card view does not look at the file; it looks at the flags Meteor-Files
writes at upload time:
if(isImage) img.attachment-thumbnail(src="{{link}}")
...
else span.attachment-thumbnail-text= extension
An attachment that came through a migration can arrive without them - no
isImage, and often no `extension` or `type` either - so it fell through to the
last branch and printed an extension that was not there: an empty box. The same
`link` in the download button worked, because a download needs no flag. The
viewer refused to open it for the same reason.
The kind of a file is derivable, and models/lib/attachmentKind.js is now the one
place that derives it: from the mime type where the document has one (in any of
the fields that have carried it over the years - type, mime, mime-type,
contentType, versions.original.type), and from the file NAME where it does not.
A flag the document states as true is believed, never contradicted; the name is
consulted only when there is no stated type, so a notes.txt that really is
image/png stays an image and does not also become text. The card gallery, the
"add cover" menu and the viewer all ask it, so a thumbnail that renders can also
be opened.
A startup repair (schema upgrade step `attachment-kind-flags`) writes the same
answer back to the documents, so the REST API, the exports and everything else
reading those flags agree with what is on screen. A file whose kind cannot be
told from either its type or its name is counted as unresolved rather than
guessed at.
tests/attachmentKind.test.cjs pins the rules - the reported case first - and the
wiring: 17 kinds derived from a name alone, mime beating a misleading name, a
name that must not be trusted to be a plain name (path separators, query
strings, dotfiles), the type read from each of the fields that carry it, and a
repair that writes exactly what is missing and nothing else.
NOT verified here: no server and no node in this environment, so the rules were
replayed against a model of the module rather than executed. That replay caught
three real mistakes in the first draft (a query string eating the extension, a
name overriding a stated type, and the repair rewriting a document that was
already correct), which are fixed.
Thanks to S0QR2 and xet7 !
Fixes #6532,
|
||
|
|
302bd90410 |
A removed DDP session no longer crashes the server on its 101st message.
From the #6492 comments today, on WeKan 10.40 with real users: SyncedCron: Fatal error encountered (uncaughtException): TypeError: self._pendingRemoveFunction is not a function at Session.send (packages/ddp-server/livedata_server.js:362:14) at Session._stopSubscription (packages/ddp-server/livedata_server.js:823:10) at Session.unsub (packages/ddp-server/livedata_server.js:562:12) snap.wekan.wekan.service: Main process exited, code=exited, status=1/FAILURE snap.wekan.wekan.service: Scheduled restart job, restart counter is at 4. It is a state-machine hole in Meteor's ddp-server. `_removeSession` sets `session.messageQueue = []` and `session._pendingRemoveFunction = remove`; when `remove()` runs it clears the function and deletes the session but LEAVES the queue - an empty array, which is truthy. `Session.send` then takes the queueing branch for a session that no longer exists, and the message past `maxMessageQueueLength` (100 by default) calls that now-null function. It runs from an Immediate, via unsub -> _stopSubscription -> send, with no try/catch above it, so it is an uncaught exception - and synced-cron's handler exits the process on one. systemd restarts, every user is disconnected, new cards stop arriving until a reload, and the restart loop reads as "WeKan is slow and the CPU is high", which is exactly what the reporter describes. It needs a busy server: a session has to disconnect while more than ~100 further messages are still addressed to it. That is why it shows up with fifty users and never in a quiet test. The guard patches Session.send once, from the first connection (the Session class is not exported, so an instance is how the prototype is reached): a queue with no remove function belongs to a session that is already gone, so the queue is dropped and send() takes its ordinary path - which, with no socket, does nothing. Nothing is lost that was not already lost, the disconnect-grace queue for a real reconnect is untouched, and a valid overflow still removes the session. tests/ddpSessionSendGuard.test.cjs replays the upstream state machine: it asserts the unguarded version really does throw on the 101st message, that the guarded one does not, that a session still waiting for its client keeps its queue, that a legitimate overflow still calls the remove function exactly once, and that a live session sends as before. NOT verified here: there is no server in this environment, so this is reasoned from the ddp-server source in .meteor/local and replayed against a model of it. The high CPU the issue opened with is a separate thread (the FerretDB $changeStream busy loop); this fixes the crash-restart loop reported today. Thanks to bluetopaz1204, Nissulya and xet7 ! Fixes #6492, |
||
|
|
f15d0c0cba |
Multitenancy: the three tenant modules must be ES modules.
Every app file is an ES module in Meteor, so `module.exports = {…}` in one of
them throws the moment the CLIENT bundle loads it:
Uncaught Error: ES Modules may not assign module.exports or exports.*,
Use ESM export syntax, instead: ./models/lib/tenantAdmin.js
and because it throws, every module after it in the client graph never runs -
models/users.js imports tenantAdmin, so the whole client went down with it.
models/lib/tenants.js, tenantAdmin.js and tenantBackup.js now export with ESM
syntax, and every importer uses import instead of require(). The .cjs unit tests
load them with a dynamic import(), the way tests/cardUrl.test.cjs already loads
its module.
tests/tenantWiring.test.cjs guards both halves, so the same crash cannot come
back quietly.
Thanks to xet7 !
|
||
|
|
36b899b9d6 |
Multitenancy: one WeKan server for many domains, with Organizations as tenants.
Implements option D of docs/Design/Multitenancy/Multitenancy.md, which that document now describes as shipped. An Organization may claim hostnames (Admin Panel / People / Organizations -> Edit), carry its own branding - product name, logos, help link, legal notice and theme colour - and have its own Organization admins, appointed from the row's "..." menu. The request's host picks the Organization; its branding replaces the instance branding for that request, and the client bundle that host serves points its DDP connection back at that host instead of at the one ROOT_URL. An Organization admin administers their own Organization and nothing else: its people, its Organizations row, its theme colour and its backups. They can never grant the site-wide Admin flag, never manage a site admin, and never see another Organization's people or archives. Per-tenant backup and restore is one new control in Admin Panel / Attachments / Backup - Scope. An Organization's archive holds its boards and everything on them plus the attachments those boards use, and no accounts, no instance settings and no org/team documents, because those are shared. A restore may only write to boards that Organization owns: the board ids are the intersection of what the archive claims with what the Organization really owns, every document is checked against that, and "replace all" replaces that Organization's documents rather than everyone's. Admin Panel / Settings / Visibility gains a Change color section above Logo: the site theme, rendered by the SAME shared picker as Board Settings and Member Settings - one template for all three, the way one shared table page serves every table. Its design is the new docs/Design/Page/Theme.md. The order of themes is WeKan's default theme, then the site theme (an Organization's own value on its own hosts), then a user's own override; a board's own colour still owns the board page. All of it is OFF unless the server is started with MULTITENANCY=true (plus MULTITENANCY_TRUST_PROXY_HOST=true when a trusted proxy sets X-Forwarded-Host), so an instance that has never heard of tenants answers exactly as before. One WeKan server per customer remains the supported topology for customers who must not share a process, and the design says plainly what this does NOT isolate. The decisions are three pure modules - models/lib/tenants.js, tenantAdmin.js and tenantBackup.js - so the same rules run on the client, on the server and in the tests. Four new suites pin the separation rather than the plumbing: forged Host headers, cross-tenant queries, privilege escalation and cross-tenant restores. Thanks to xet7 ! |
||
|
|
f0ea1601b3 |
Admin Panel: the board-member restriction moves to Organizations and Teams, as two.
"Add board members only from the same Organization or Team" was one checkbox in the
Login pane - which is where neither of the two things it restricts lives. It is two
checkboxes now, each in the pane it is about:
Admin Panel / People / Organizations [_] Add board members only from the same
Organization
Admin Panel / People / Teams [_] Add board members only from the same Team
A candidate may be added to a board when they share at least one ENABLED kind with
whoever adds them: an Organization when the first is on, a Team when the second is.
With both on that is "an Organization OR a Team" - exactly the rule the single
setting had - so an install that has the old field and neither new one is migrated
to both on first start, and nobody's restriction changes by upgrading. Ticking only
one is the new, narrower choice that was not expressible before.
models/settings.js boardMembersFromSameOrgOnly, boardMembersFromSameTeamOnly
server/models/settings.js the startup migration from the old single field
server/lib/orgTeamRestriction.js
boardMemberRestriction(setting) reads the pair - and
still reads the old field, so an install behaves the
same before the migration runs; canAddUserToBoard()
takes a flag per kind (the old restrictEnabled still
means both)
models/users.js sharesOrgWith / sharesTeamWith, and
sharesRestrictedOrgOrTeamWith(user, restriction)
Enforced in the same three places as before - inviteUserToBoard, the user-search
typeahead that must not offer what the server would reject, and the imported-user
reconciliation - so the two settings cannot drift apart from what the UI says.
Thanks to xet7 !
|
||
|
|
1fb382f0eb |
Stop Admin Panel / Problems showing a finished board-repair and info CPU rows.
#6520: the Problems "Status" page showed "Board data-repair — 146/146 boards" running forever (plus a matching "Migration or repair" login warning), and the CPU area showed dozens of "new problems" on an idle server. Board repair stuck at "running": getInProgress() trusted the raw `running` flag. The startup repair DOES write running:false on completion, but its progress callback also fired a NON-awaited running:true write when boardsDone === boardsTotal; being fire-and-forget, that write could land AFTER the awaited completion write and pin the doc at "running, 146/146". A process killed mid-repair leaves running:true too. Both now clear: * the startup progress callback no longer writes the terminal boardsDone === boardsTotal update (the completion write owns the final state), closing the race at the source; * getInProgress() now asks the new pure isStatusActive() instead of reading `running` directly - a doc is "in progress" only while running AND not in a terminal phase (completed/error/done) AND not already finished by count (done >= total) AND updated recently (a running flag with no recent progress write is a crashed run). This also heals docs already stuck on an instance, and fixes the same class of stale flag for the text migration. Because the login "Migration or repair" warning keys off getInProgress(), it clears too. CPU "57 new problems" on an idle server: the count in eventLogProblemAreas counted every unacknowledged row in a stream. The CPU monitor writes one 'detected' row when a high-CPU period starts and several severity:'info' rows ('remediated' when it ends, 'rate-limited' for mitigation, FerretDB governor chatter), so each brief, already-over spike looked like several "new problems". The count now excludes severity:'info' rows (via the new newProblemsSelector) - notices that a problem was handled or cleared are not problems. Rows with no severity are still counted, so nothing unclassified is silently dropped. Both decisions are pure, unit- and negative-tested (statusActive.test.cjs, eventLogProblems.test.cjs), and registered in test:unit:node. Thanks to Alishara and xet7 ! Fixes #6520, |
||
|
|
aa356d715d |
Run the five test suites that existed but were never executed, and delete dead files.
Five mocha suites sat in the tree looking like they were being run, and were not: `meteor.testModule` points at client/lib/tests/index.js and server/lib/tests/index.js, those indexes list their suites with explicit imports, and these five were never added. server/lib/tests had 49 suite files but 48 imports. Two of them are *bleed security regression suites - checklistbleed (cross-board checklist/checklist-item move denial) and proxybleed (header-login trusted-source and request-IP handling) - exactly the kind of test whose silent absence lets a fixed vulnerability come back unnoticed. The other three are filenameTruncation, alwaysShowCodeAsText and renderLinksPlainText. All five are now imported by their index. Every symbol they import was checked to still exist first: denyCrossBoardMoveByCard / denyCrossBoardMoveByChecklistItem (server/lib/utils.js), getRequestIp / isTrustedHeaderLoginSource / findOrCreateHeaderLoginUser (server/lib/headerLoginAuth.js), truncateFilenameToBytes / sanitizeFilename (models/lib/filenameSanitizer.js), getSecureDOMPurifyConfig / sanitizeHTML (imports/lib/secureDOMPurify.js) and the Markdown export of the wekan-markdown package. They have never run in this state, so they may still fail on their assertions - that is the point of running them. tests/testsAreRegistered.test.cjs is added as a guard: it fails if any *.tests.js file in either directory is not imported by its index, and names the two *bleed suites explicitly so a future tidy-up cannot drop them again quietly. Also deletes files that nothing loads: - client/components/main/responsiveFixes.css (162 lines, imported by nothing, so never in the bundle - package.json sets meteor.mainModule, which disables Meteor's eager loading). - models/backgrounds.js, models/backgrounds.server.js and server/permissions/backgrounds.js - three empty tombstones whose only content was a comment saying board backgrounds became board-level Attachments and the file is "intentionally empty and no longer imported". The live paths (server/boardBackgrounds.js, server/publications/backgrounds.js) are different files and are untouched. Thanks to xet7 ! |
||
|
|
a440d44ea4 |
Remove the cron migration subsystem: it never ran and had no UI.
Nothing scheduled it and nothing rendered it, but every logged-in client still paid for it: - initializeCronJobs() (server/cronMigrationManager.js) was NEVER called, so the SyncedCron.add() registrations and the 5s job-queue processor never started. - boardMigrationDetector.start() sat behind a commented-out Meteor.startup hook, with the note "Automatic migration detector is disabled - migrations only run when opening boards". - The Admin Panel had no Cron page at all: no route in config/router.js, no button in settingHeader.jade, no template ever included, and every helper, event and reactive var for it commented out in settingBody.js. - Yet imports/cronMigrationClient.js WAS imported by client/imports.js, so every client subscribed to three publications and polled cron.getMigrationProgress every 10 seconds, forever, for a feature with no user interface. Migrations already run - and are already reported - through the paths that work: Admin Panel -> Attachments (database migration) and the on-board-open repair, both driven by the shared migrationProgress overlay dashboard mounted app-wide in defaultLayout, plus the in-progress list on Admin Panel -> Problems -> Summary. Removed: cronSettings.jade/.css, imports/cronMigrationClient.js, models/cronJobStatus.js, server/cronMigrationManager.js (28 admin-gated cron.* methods that no UI called), server/cronJobStorage.js, server/boardMigrationDetector.js and the three publications that fed only the deleted client module (cronJobs, cronMigrationStatus, migrationProgress). KEPT on purpose: server/cron/syncedCron.js, which is SyncedCron itself and is used by the backup schedule (server/methods/backup.js) and scheduled rules (server/scheduledRules.js). getInProgress() in server/lib/systemStatus.js no longer reads cronJobStatus. Leaving that check would have been worse than useless: a leftover status:'running' doc from an older version now has nothing to clear it, so Admin Panel -> Problems would report "Migration job X running" forever. The 40 i18n keys that only the deleted template used are left in place - dropping them from every language file would discard human translations for keys that may be reused. Thanks to xet7 ! |
||
|
|
f04c484518 |
Show the current CPU usage on Admin Panel / Problems / CPU usage.
The page listed only PAST high-CPU periods (the event rows written by the CPU monitor), so it could not answer "what is the CPU doing right now?" at all - the one question an admin opens that page to ask. A live line now sits between the page title and the search box: the current system CPU percentage, the core count, the 1/5/15 minute load average and the coarse "what WeKan is doing" label, refreshed every 5 seconds and outlined in red while the monitor considers the CPU sustainedly high. The figure comes from getCurrentCpu() in the CPU monitor, which reads the same sample the monitor writes its event rows from, so the header and the rows below it can never disagree. It reads module state only - no sampling of its own - so polling it is cheap. When the background monitor is disabled (WEKAN_CPU_MONITOR=false) it would otherwise always read 0%, so in that case the percentage is measured between calls using a SEPARATE baseline, which cannot disturb the monitor's own delta, and `monitored: false` is reported alongside. Thanks to xet7 ! |
||
|
|
d168a9d302 |
Add a Repair button for "Broken cards N" in Admin Panel / Problems / Summary.
The Summary page reported "Broken cards N" and told the admin to "open the board to auto-repair, or run the repair migration", but there was no button anywhere to run one - and worse, no repair in the app could actually clear that count. countBrokenCards() counts every card missing a boardId OR a swimlaneId OR a listId. repairAllBoards() walks only NON-ARCHIVED boards and only ever sets swimlaneId, so three kinds of counted card could never be repaired by anything: cards on an archived board, cards with a missing listId, and cards with no boardId at all. The count sat there forever with nothing to press. The new repairBrokenCards method (admin only) runs the standard per-board pass and then closes those gaps: orphaned-swimlane cards on archived boards, and cards missing a listId and/or swimlaneId on any board, are assigned to that board's first usable list/swimlane (creating a default one if the board has none). Each board resolves its default list/swimlane once rather than once per card. Cards with no boardId cannot be placed on any board - guessing would drop a user's card onto an unrelated board - so they are reported back as `unfixable` and left alone, never deleted, and the result line says so instead of leaving a count that never reaches zero unexplained. What counts as broken now lives in one pure module, models/lib/brokenCardsRepair.js, used by BOTH the count and the repair, so they can no longer drift apart and leave the admin pressing a button that does not move the number. Progress is persisted through setBoardRepairStatus, so a running repair shows up in the same "in progress" list as the startup pass. Adds unit tests (positive + negative) for the shared rule, including the regression itself: every card the count reports as broken must be either repairable or explicitly unfixable, never silently neither. Thanks to xet7 ! |