Commit Graph
346 Commits
Author SHA1 Message Date
Lauri Ojansivu ed5a534941 Updated to Meteor 3.6.1.
meteor update --release METEOR@3.6.1 failed: Meteor 3.6.1 pins
ddp-server@~3.6.1, and WeKan's local fork of ddp-server was 3.6.0_1.
Of WeKan's six Meteor package forks only ddp-server changed in 3.6.1,
so its 3.6.1 fixes (non-string unsub and ping ids are refused, a
protocol handler that throws synchronously is contained) and their
upstream tests are rebased onto the fork, now 3.6.1_1. The other
packages 3.6.1 bumps (accounts-base, accounts-express,
accounts-password, minimongo, mongo, webapp) are updated in
.meteor/packages and .meteor/versions.

tests/meteor353SecurityFixes.test.cjs now expects METEOR@3.6.1 and
checks that the fork carries the 3.6.1 fixes and not the older code.

Thanks to xet7 !
2026-11-14 18:23:50 +02:00
Lauri Ojansivu 0fbef8936f Updated to Meteor 3.6.
From 3.6-rc.1. `meteor update --release METEOR@3.6` refused it: WeKan's
forks of six Meteor packages in packages/ (allow-deny, ddp-server,
dynamic-import, facebook-oauth, google-oauth, shell-server) declared
3.6-rc.1's versions with a _1 wrap number, and a local package
overrides the release's, so ~3.6.0 could not be met. Meteor 3.6 changed
those six packages only in their version line (compared on GitHub,
release/METEOR@3.6-rc.1...release/METEOR@3.6), so each fork now
declares 3.6's version with its _1 wrap number; .meteor/packages drops
the rc pins, and .meteor/versions, @meteorjs/rspack 3.0.0 and the
lockfile are what meteor update wrote. webapp is 2.4.0.

The Dockerfile's METEOR_RELEASE is METEOR@3.6. The Bun build's patch
applies unchanged to Meteor 3.6, which still has no Bun ESM loader of
its own: it is meteor-3.6.patch, checked against 3.6's commit
e730097c. tests/meteor353SecurityFixes.test.cjs is moved to 3.6 by
decision, after that check. WeKan builds with Meteor 3.6, and the node
suites pass (2162 run, 0 failed).

Thanks to xet7 !
2026-11-10 09:20:28 +02:00
Lauri Ojansivu 582a22c291 Fix GitHub code scanning code-quality findings.
Real faults: a card's original-position description formatted a promise
because it did not await the history; the attachment swipe distances and
two drag-scroll locals were undeclared globals; a file that cannot be read
during a GridFS upload left the upload open; api.py called exit() instead of
sys.exit(); a rules test redefined a property and a security-log test kept
an unreachable branch. Also 31 missing semicolons, unused imports in the
card details, exporters and attachment API, unused Python imports, and
comments on empty except clauses. The list-sync scanner test cut its source
at the last Meteor.startup, which the new index startup of #6855 had moved.

Thanks to GitHub CodeQL and xet7 !
2026-11-02 14:15:02 +02:00
Lauri Ojansivu e91c14cd9a LDAP: a reused login name no longer opens the previous owner's account.
An account found by username or e-mail that records another directory
entry's identifier (same attribute, other value) is refused at login and
skipped by the import. An existing account now records its identifier and
its attribute, so LDAP_UNIQUE_IDENTIFIER_FIELD takes effect for it.
LDAP_EMAIL_MATCH_REQUIRE looks users up by username instead of _id, which
never matched. The background sync skips an account whose username matches
several entries instead of binding it to the first.

Thanks to Raymond-Voogt and xet7 !

Fixes #6859,
2026-11-02 13:31:40 +02:00
Lauri Ojansivu 5c50f38e25 SAML logins are verified by @node-saml/node-saml 5.2.0, as package.json says.
Dependabot's 5.1.0 -> 5.2.0 bump (#6850) changed the app's package.json,
but a SAML login is verified by the wekan-accounts-saml package's own
copy, pinned by its Npm.depends to 5.1.0 - so nothing that runs changed.
5.2.0 is a hardening release a login relies on: it rejects a message
with more than one Issuer, checks idpIssuer on the Response and its
assertion, rejects a parsed query whose RelayState is not the signed
one, and checks a POST LogoutResponse's status and issuer.

The package pins 5.2.0 now. samlLogin.test.cjs required '5.1.0' in one
place and '^5.1.0' in the other; it requires the package and package.json
to name the SAME version, and at least 5.2.0, so a bump of one alone
fails.

A login roundtrip with the package's own copy (node-saml 5.2.0,
xml-crypto 6.4.0) and WeKan's options: a signed Response and a signed
Assertion log in; a NameID changed after signing, a signature by another
key, an unsigned response, and an answer to a request WeKan never made
are refused. saml-popup-error.e2e.js completes a real signed login in
the browser.

Thanks to xet7 !
2026-10-31 23:06:08 +02:00
Lauri Ojansivu b4e5f90afb Card links never launch an OS handler with a code-execution history.
Custom URL schemes in card text link only when Admin Panel -> Features ->
URL lists them, and never javascript:, data: or another scheme that runs
code in the page. A listed operating-system handler was linked, though, and
some have a public code-execution history: ms-msdt (Follina,
CVE-2022-30190), search-ms and search, ms-officecmd, ms-appinstaller,
ms-cxh and ms-cxh-full, and telnet - the last step of the 2026 Edge full
chain, where Windows ran telnet.exe from a user-writable PATH directory.
An administrator listing one would let any board member plant a link that
runs something on whoever clicks it.

- They are never linked, listed or not, by the app's parser and by the
  markdown package's copy of the rule (the two lists must be identical),
  and a click on one does nothing should such a link reach the page.
- A card title or description, comment, checklist or checklist item that
  ADDS a link to one is shown in Admin Panel -> Problems (HandlerLink,
  CWE-939), with who wrote it; the text is saved as written and the writer
  is told nothing. The word in prose, or a link the text already had, is
  not recorded.
- docs/Features/Admin-Panel/Settings/Visibility.md lists both kinds of
  never-linked scheme, and says what a listed file: does on Windows (an SMB
  link outside the network sends the clicker's NTLM hash).

Tests: tests/urlSchemeAllowlist.test.cjs (positive and negative, through
the real DOMPurify, both sanitizer passes and the detector; fails on the
old code), and custom-url-schemes.e2e.js, which passes in Chromium and
WebKit: listed handlers do not link, a description saved with one through
the editor is recorded for its writer, and a kept link or a comment that
only mentions the word is not. Firefox does not start in this
environment.

Thanks to xet7 !
2026-10-30 01:19:16 +02:00
Lauri Ojansivu ca2dc5fae5 Sandstorm: build from install.sandstorm.org, and link sandstorm.org everywhere.
v12.69's build-sandstorm in release-all.yml stopped because the
certificate of install.sandstorm.io had expired. It fetches the installer
from install.sandstorm.org, as sandstorm.yml and sandstorm-store.yml
already did, and so does releases/install-sandstorm.sh. That installer
downloads Sandstorm from dl.sandstorm.org and configures a development
server at local.sandstorm.org, so the docs follow: docs, apps, dl, install
and local.sandstorm.io links and addresses become sandstorm.org in the docs,
SECURITY.md, code comments and the accounts-sandstorm README, each URL
checked to answer there. demo.sandstorm.io stays, as it has no sandstorm.org
name; released CHANGELOG sections are records and stay as they are. The
release audit's baseline allows the two code comments' docs.sandstorm.org.

tests/sandstormOrgHosts.test.cjs: every Sandstorm build installs from
install.sandstorm.org, and no tracked file names a sandstorm.io host
outside those kept on purpose; it fails on the old release-all.yml.

Thanks to xet7 !
2026-10-30 00:27:54 +02:00
Lauri Ojansivu 120f484a30 Meteor 3.6-rc.1, with WeKan's six Meteor package forks rebased onto it.
meteor update --release 3.6-rc.1 failed with "No version of
shell-server satisfies all constraints" (and the same for
dynamic-import, allow-deny, ddp-server, facebook-oauth and
google-oauth): those six are WeKan's forks in packages/, made because
Meteor 3.6-rc.0 lacked the 3.5.3 security fixes, and pinned to rc.0's
versions.

Meteor 3.6-rc.1 carries the security fixes of 3.5.3 and 3.5.4, but not
what is WeKan's own in the forks: the Admin Panel / Problems reports of
refused attempts, and the crypto-RNG keys of dynamic-import and meteor
shell (rc.1 still makes them with Math.random()). So the forks are kept
and rebased: each is rc.1's package with WeKan's changes over rc.0's
package merged three-way onto it. The 3.5.3 hunks merged away, as rc.1
has them; what remains over rc.1 is only the hooks and the keys. The
versions are rc.1's with a _1 wrap number.

@meteorjs/rspack moves to 3.0.0-rc.2 with the release. The Dockerfile's
METEOR_RELEASE and the snap description follow. The experimental Bun
build's Meteor patch applies unchanged to 3.6-rc.1; prepare-meteor.sh
now checks for rc.1's tag commit and applies meteor-3.6-rc.1.patch, and
the rc.0 copy is removed.

tests/meteor353SecurityFixes.test.cjs and meteorForkRandomKeys.test.cjs
are moved to rc.1 with their assertions kept;
meteor-353-security.e2e.js passes on rc.1 in Chromium and Firefox.

Thanks to xet7 !
2026-10-28 18:49:59 +02:00
Lauri Ojansivu ebcd02be6f Hall of Fame regression audit: every fixed vulnerability still fixed, siblings of six of them closed.
Every Hall of Fame vulnerability without a test naming it (24 names, 30
advisories) was checked against the current source. No fix had been
reverted. Looking for the same mistake elsewhere found siblings:

- FloppyBleed: the fs-path-heal upgrade step joined an attachment's
  stored name into candidate paths as-is; a record a client inserted
  named ../../../etc/passwd made the next upgrade copy that file into
  storage - an arbitrary file read. Only the name's last component is
  used now; the bulk move limits a legacy name's extension the same way.
- FilePathBleed (GHSA-g6vm-7757-pr88): the insert guard looked only
  inside versions; with versions left out ostrio:files falls back to a
  top-level path, which removing the record deletes and validation
  reads. A client's top-level path is refused for attachments and
  avatars, recorded by the existing canaries.
- MoveStorageBleed: validateAttachment, which deletes a file failing the
  current upload rules, was open to anybody who could see the board, a
  public one included. Only who may change the file, or a site admin,
  validates now; a refusal is recorded (authz.attachment-validate).
- HookUrlBleed / IntegrationBleed: the REST reads of a board's
  integrations gave the webhook URL - whose path is its secret - to
  every member reading the board; non-admins get what the publication
  gives them.
- AttachmentMigrationBleed: four migration methods answered any
  logged-in user about any board, deleteDuplicateEmptyLists.getStatus
  with a private board's list titles; they require a visible board and
  record refusals (authz.migration-board).
- LegacyAttachBleed (GHSA-xcxp-hx9w-q5q9) and MimeStorageBleed
  (GHSA-rv5g-5p4g-3v89): the legacy route judged a name dangerous only
  for .svg, the response policy missed x-javascript, ecmascript, xsl and
  +xml types, and the sniffers missed <tag/onx= handlers.

OIDCBleed refusals are now recorded in Admin Panel / Problems too. New
suites name the vulnerabilities they guard, existing ones name the
advisories they already covered, and tests/securityRegressionCoverage
counts 128 of 137 published vulnerabilities with a named test (was 125).

Thanks to xet7 !
2026-10-27 16:28:12 +02:00
Lauri Ojansivu 6efd39a70e dynamic-import and meteor shell keys come from the crypto RNG.
GitHub CodeQL alert 591 (js/insecure-randomness, CWE-338), in the
dynamic-import fork: the key that lets a request read the SERVER's
dynamic modules (?key= on /__meteor__/dynamic-import/fetch) came from
Math.random(), whose xorshift128+ state can be recovered from earlier
outputs, and was compared with ===. meteor shell's connection key, which
runs code in the server process, was made and compared the same way.
Meteor 3.5.3 and 3.6-rc.0 both have this.

Both forks now use crypto.randomBytes (160 and 128 bits) and compare with
crypto.timingSafeEqual. tests/meteorForkRandomKeys.test.cjs runs both, and
fails on any Math.random() in the forks and on a key, secret, token,
nonce, salt, password or code made from Math.random() anywhere in the
tree. A wrong key is not recorded in Admin Panel / Problems: another
WeKan instance behind the same load balancer legitimately sends its own.

Thanks to GitHub CodeQL and xet7 !
2026-10-22 04:56:47 +03:00
Lauri Ojansivu e0189bc53b Meteor 3.5.3's six security fixes on Meteor 3.6-rc.0.
Meteor published the same six fixes as 3.3.3, 3.4.2 and 3.5.3 on
2026-10-16. 3.6-rc.0, which WeKan runs, does not have them: its tag is
behind 3.5.3 by exactly the 15 security commits, and neither it nor
Meteor's devel branch has the fixed code. Going back to 3.5.3 would also
mean Node.js 24 and Rspack 1, so WeKan carries the fixes in packages/,
where a package overrides the release's own: 3.6-rc.0's allow-deny,
ddp-server, dynamic-import, facebook-oauth, google-oauth and shell-server
with Meteor's 3.5.3 patch applied unchanged, each marked with a _1 wrap
number. ddp-server leaves out uWebSockets.js, as Meteor's published
package does; it is only for the opt-in uws transport and came from a git
URL.

- DDP: a message named __proto__, toString or not a string, and an async
  handler that rejected, crashed the server.
- allow/deny: a top-level __proto__ in an update was missing from the field
  list the validators saw.
- dynamic import(): requests are bounded in size (413) and complexity
  (400).
- Google and Facebook direct-token login: a token issued to another
  application was accepted; identity now comes from the provider, and a
  Facebook verification error no longer carries the app secret.
- meteor shell: its history and compile cache are private.
- Deploy discovery is in meteor-tool, which an app cannot replace; WeKan is
  never deployed with meteor deploy, and a test keeps it so.

Refused attempts are in Admin Panel / Problems as Meteor DDP, Meteor
allow-deny, Meteor dynamic-import and Meteor OAuth, through a hook the
packages call (server/lib/meteorSecurityHook.js); none blocks an account.
An oversized import() body, an unknown ordinary DDP name and a network
failure are refused without a row, because ordinary use can reach them.

tests/meteor353SecurityFixes.test.cjs runs each fix's code cut out of the
fork and searches the tree for the shape of each fault; all of them fail on
the unfixed 3.6-rc.0 packages. It also fails when .meteor/release moves
on, because a fork would silently keep 3.6-rc.0's code.
tests/playwright/specs/meteor-353-security.e2e.js sends each attack to a
running WeKan built with the forks. The forked files are recorded in the
source audit baseline, and the suites that check WeKan's own methods and
subscriptions skip Meteor's package tests.

Thanks to Meteor developers, Vext Labs and xet7 !
2026-10-22 04:12:13 +03:00
Lauri Ojansivu b933a69cd4 People shows everyone's Last active; inactive users can be disabled; LDAP sync honours its search filter.
Admin Panel / People showed "Last active" as "-" for every user but the
administrator: the people publication did not carry lastConnectionDate.

USERS_DISABLE_INACTIVE_AFTER_DAYS disables, once a night, accounts that have
not used WeKan for that many days, and revokes their logins. Admins are
never disabled. An account with no recorded activity starts its count on the
first run rather than from createdAt, and re-enabling an account restarts it.
The setting is in Admin Panel / People / Login as well as in the
environment, and the job resolves it every night, so a change there needs no
restart. Every platform's settings file lists it.

LDAP background sync looked a user up by id without LDAP_USER_SEARCH_FILTER,
so an account the filter excludes - one disabled in Active Directory - could
not log in but was still "found". It was never disabled, and a manual
disable was undone on the next run. The filter is now ANDed into the lookup.
An account disabled for inactivity is not re-enabled by the sync.

From the patch by Raymond-Voogt, with the setting moved into the Admin
Panel's login settings. Tests: tests/inactiveUsers.test.cjs,
tests/ldapBackgroundSync.test.cjs, tests/ldapUserIdFilter.test.cjs,
tests/authConfigCatalog.test.cjs and
tests/playwright/specs/inactive-users-last-active.e2e.js.

Thanks to Raymond-Voogt and xet7 !

Fixes #6783,
Fixes #6784,
Fixes #6785.
2026-10-19 17:35:51 +03:00
Lauri Ojansivu b7589737f5 File docs/Features the way the WeKan menus are.
A feature's guide now sits under the menu it is used from, read from the
templates rather than from where somebody once put it: Header-Bar,
All-Boards, Pages, Board-Header (search and every Board View), Board-Sidebar
(Board Settings, Filter, Members, Labels, Archive), Rules, Swimlanes, Lists,
Cards, Member-Settings, Admin-Panel and Login-Page. Topics used from several
menus (editor, history, theme, translations, email, troubleshooting) are in
General.

- Each area has a README mapping its menu entries to their guides and to the
  template or server module that implements them. Board-Header/README.md
  lists all 40 Board View entries with the template boardBody.jade renders;
  five views (Table, Calendar Mode, Time, Timeline, Map) have no guide of
  their own yet and say so.
- Board-View.md listed 25 views while BOARD_VIEWS has 40; it now lists all
  of them with their English labels.
- Pages keep their file names. Where a released changelog links an old path,
  a "# Moved" page stays there and points to the new one; test-menu.sh skips
  folders holding only those.
- Undo was filed under Login; it is General/Undo now.
- Every link in docs, code comments, scripts and tests follows the move;
  docsLinksResolve checks them all.

Tests that read a doc follow it to its new place. boardViewSettings now fails
when Board-View.md or Board-Header/README.md differs from BOARD_VIEWS, or
names a template boardBody.jade does not render.

Thanks to xet7 !
2026-10-16 23:45:35 +03:00
Lauri Ojansivu 70dcc2a134 Remove files nothing uses, and point their tests at the code that runs.
Found by following every import, re-export and require from client/main.js
and server/main.js (meteor.mainModule: only what that reaches is loaded) and
each local package's package.js:

- packages/wekan-fullcalendar/fullcalendar/ (88 files) and update.sh: the
  vendored FullCalendar v3 and the script that updated it as a git
  submodule; the package takes FullCalendar 5 from npm (Npm.depends).
- packages/wekan-fontawesome/fontawesome-free: js/, sprites/, metadata/,
  attribution.js and the .min.css copies; package.js adds only the plain CSS
  and the webfonts. Its package.json no longer names the removed files.
- models/lib/propagateMembers.js and models/lib/teamBoardMemberSync.js:
  replaced on 2026-10-14 by models/lib/groupBoardMembership.js (memberships
  that record their team or org, #4178), which the server uses. Their tests
  exercised the old modules; the same scenarios now run against planGain /
  groupChanges, and the wiring checks are kept.
- models/lib/recoveryPlan.js and its test: a model of the SQLite recovery
  policy that nothing ran; releases/ferretdb/sqlite-recovery.mjs carries it
  out and tests/sqliteVerifiedRecovery.test.cjs tests that. The Recovery
  design page says so.
- packages/wekan-ldap/server/configResolver.js: a vendored copy nothing
  imported - the LDAP package reads its settings through the app's
  accessor. Its sync test is now a check that no package carries such a
  copy; three comments that sent readers to it explain the reason instead.

docs/Design/TeamsOrganizations.md also said losing a team removes nothing;
since #4178 a team takes back what it gave.

Thanks to xet7 !
2026-10-16 22:54:48 +03:00
Lauri Ojansivu a944be1817 LDAP background sync imports users again, and keeps the interval it is given.
After the 12.47 fix, #6771 comment 6197931378 showed the background sync
running and importing nobody: "filter": "(&(&(objectclass=person))(uid=\2a))",
"Search result count 0". importNewUsers() asked for every user with the string
'*', and the RFC 4515 escaping added for login names on 2026-09-27
(679a8b3499) turned the wildcard into a literal asterisk. The wildcard is now
reachable only through ALL_LDAP_USERS (userSearchValue.js), a Symbol that a
login request cannot carry, so a typed '*' is still escaped.

The sync also ran far more often, or less often, than set: later.js is a
calendar, and every(n).minute() is "minutes 0, n, 2n ... of each hour", an
interval only when n divides 60. 2 hours and 1 day both became hourly, 90 s
became every minute, and 3600 (seconds, typed as milliseconds) every 4
seconds. Milliseconds now become an interval later keeps exactly - seconds
and minutes dividing 60, hours dividing 24, whole days - pinned to the start
of the unit; anything else is rounded to the nearest one with a warning, and
an interval under a minute is warned about as probably seconds.

tests/ldapImportAllUsers.test.cjs reproduces the reported filter and checks
the wildcard, the still-escaped typed '*', and that no code searches the
string '*'. tests/ldapSyncSchedule.test.cjs checks every interval up to 36
hours reaches later only as an every(n) it keeps, and with the real later.js
that 1 min ... 1 week keep their spacing.

Thanks to tromlet and xet7 !
2026-10-15 20:45:49 +03:00
Lauri Ojansivu 7dfd942ff6 LDAP: a sync interval in milliseconds no longer stops WeKan.
"[uncaughtException] WeKan is stopping: TypeError: string.toLowerCase is
not a function at later.parse.text ... at Object.schedule
(wekan-ldap/server/sync.js)", in a snap restart loop. The docs give
LDAP_BACKGROUND_SYNC_INTERVAL in milliseconds, settings_get() turns a
numeric value into a Number, and the schedule handed it straight to
later's text parser, which threw from a timer. Text later could not read
did not throw, but made a schedule that never ran - as a quoted
'every 1 mins' from a compose file did, the second report in #2354.

packages/wekan-ldap/server/syncSchedule.js reads the setting and never
throws: milliseconds (a Number or digits) become that interval, later.js
text is read as before, one pair of surrounding quotes is removed, unset
keeps the original default (recur().on(0).minute()), and anything
unreadable logs why and uses the default. The docs, the snap description
and the compose files say both forms work, instead of "leave this unset
so it does not crash".

Tests: tests/ldapSyncSchedule.test.cjs reproduces the crash with the real
later.js from the build, schedules 3600000 ms an hour apart and 10000 ms
ten seconds apart, reads quoted text, keeps the default, never throws on
any value a setting can hold, and fails if any server file hands a setting
to parser.text directly.

Thanks to B2RN and xet7 !

Fixes #2354.
2026-10-15 03:17:49 +03:00
Lauri Ojansivu 548834c4ee Fix five role helpers that answered the same for everybody.
Found while mapping every role check for custom board roles:
- canImportIntoBoard tested the role helpers as references
  (`!user.isWorker`, always false), so Import was offered to nobody; it
  asks the write capability now, as the server does.
- the rules list's canAdmin used `user.isBoardAdmin` without calling it,
  so every member saw the rule controls.
- the role popup's isLastAdmin compared activeAdmins() - a list - with 1,
  so the last admin was never stopped from giving the role away.
- the members widget's isWorker called Boards.hasWorker, which is not a
  collection function.
- OIDC's DEFAULT_BOARD_ID used Array#contains, which does not exist, so
  the configured role flags threw; isCommentOnly works next to the
  documented isCommentsOnly spelling.

tests/roleHelperRegressions.test.cjs pins each, and fails for any role
helper tested as a bare reference anywhere in client/, models/ and
packages/, and for a list compared with a number.

Thanks to xet7 !
2026-10-14 08:22:12 +03:00
Lauri Ojansivu 9949bca0b9 Log in a SAML binding that lacks the optional qualifiers.
A binding stored with issuer, nameID and nameIDFormat but no nameQualifier
or spNameQualifier keys was not found by identity, because a query for ''
does not match a missing field. The user was then found by username and
refused as account-already-bound-to-saml. An empty assertion qualifier now
also matches a missing one, and the next login writes them as empty
strings. A non-empty qualifier and a missing issuer still fail closed.

Thanks to xet7 !
2026-10-13 12:12:12 +03:00
Lauri Ojansivu a9c75efe60 Explain why SAML could not link an existing account, and find it by email.
Every refusal to link a SAML login to an existing (e.g. LDAP) account threw
the same "SAML identity does not match this account" and logged nothing.
Each condition now has its own reason in the server log, and a missing email
or email_verified=true attribute in the assertion is named on the sign-in
page. The refusal still fails closed. With merging on, a login name that is
the assertion's email also finds the account by a verified email, instead of
trying to create a new user. email_verified, the matching rules and the
unused SAML_ATTRIBUTES are documented.

Thanks to xet7 !
2026-10-12 22:21:30 +03:00
Lauri Ojansivu 8ab7d46714 Trust the operating system's certificate authorities for TLS.
Since v12.15 the LDAP server's certificate is verified by default, and
Node.js verified it only against the Mozilla list it is built with. A
company root CA installed on the server with update-ca-certificates was
unknown to WeKan, so after upgrading from v12.14 the snap refused LDAPS
logins with UNABLE_TO_VERIFY_LEAF_SIGNATURE.

server/main.js now adds the operating system's CAs to Node's own before any
application code runs: tls.getCACertificates('system'), and the distribution
CA bundle files Go's crypto/x509 reads. The bundle file matters in the snap:
on Debian and Ubuntu snapd keeps the host's /etc/ssl, but the per-CA links
update-ca-certificates makes point into /usr/local/share/ca-certificates,
which the snap sees from its base. Verification is not relaxed - a CA the
system does not have is still refused - and --use-bundled-ca keeps Node's
list only. It covers LDAPS, mail, webhooks and OAuth2 in every launcher.

A refused LDAP certificate now says what to do, in the log and in Admin
Panel's Test connection: install the CA on the server, or set LDAP_CA_CERT.
No hint suggests turning verification off.

tests/systemCaCertificates6762.test.cjs runs a TLS server with a certificate
from a test private CA (its key is not kept) and checks the reported error
without the CA, verification with it in the system bundle, refusal without
it, --use-bundled-ca, and the hints. Two LDAP guards follow the extended
error handling; prune-unreachable-npm.mjs leaves the regex guard's reviewed
list, as it no longer builds a RegExp.

Thanks to fvb-sb and xet7 !

Fixes #6762.
2026-10-12 11:14:34 +03:00
Michael Nutt 2b8a4a234f Defer SAML and LDAP dependencies until first use
Load SAML, LDAP and transliteration implementations when their operations
need them. Preserve registration and authentication checks, with tests
and documentation accompanying the change.
2026-10-11 23:30:56 -04:00
Lauri Ojansivu ad51a03731 Log in by full-page redirect by default with OAuth2/OIDC, Google & co, SAML and CAS.
Every login that chooses between a popup and a redirect opened a popup by
default. Google's sign-in pages, and other identity providers', can send
Cross-Origin-Opener-Policy, which makes Meteor's popup look closed at
once: the login was tried before the provider answered, and the user
was back on the sign-in page with no error. Popups are also blocked in
iframes and on some phones. The full-page redirect has no popup to lose.

- OAUTH2_LOGIN_STYLE (OAuth2/OIDC): redirect unless it says popup, in the
  server, the Admin Panel catalog and the samples.
- OAUTH_PROVIDERS_LOGIN_STYLE (Google, GitHub, Facebook, X, Meteor
  Developer, Weibo, Meetup): redirect by default, in the code, Dockerfile,
  snap, Sandstorm package and samples.
- SAML: both identity-provider profiles log in by redirect;
  SAML_LOGIN_FLOW=popup still chooses the popup, and the client no longer
  falls back to a popup while the configuration loads.
- CAS: redirects unless "popup": true. Its redirect could never finish:
  nothing called Meteor.initCas, which the package now does at startup.
  The sign-in page also passed username and password as loginWithCas's
  options and callback, so its callback never ran, and the CAS redirect
  page echoed the request address into HTML unescaped.

A redirect login's error now reaches the reloaded sign-in page, from
accounts-oauth's page-load hook and the SAML and CAS events, instead of
the page coming back silently.

Verified against a freshly built and prepared bundle with the local
identity-provider suite and no login style set: OIDC, SAML, CAS and all
seven Meteor providers log in by redirect, and each refusal is shown on
the sign-in page (31 of 31 with Chromium). Its LDAP wrong-password case
expected wording that changed in 679a8b3499 and is corrected.

Thanks to xet7 !
2026-10-08 15:18:59 +03:00
Lauri Ojansivu ed993fef84 Autolink references with an identifier and abbreviations to other tools.
Admin Panel / Settings / Features could turn one "<prefix><number>" pattern
into links (#3069). The reporter wanted "[Task:3384]" and "[Incident:3384]"
to link to their tracker, and "[TK:1223]" with TK an abbreviation of Task.
"More link rules" now takes one "<token> = <url>" per line, with {number}
and {identifier} in both, and "Abbreviations" maps an identifier to the
word the address needs. All rules are matched in one pass, earliest first,
after the #3069 pattern, and text that is already a link is never rewritten,
so no rule relinks another's link. Only an http(s) rule with exactly one
{number} is used, and the values are URL-encoded into the address.

The markdown package carries a copy of models/lib/externalLinkRules.js;
tests/externalLinkRules.test.cjs keeps the two identical and covers the
reporter's examples and the refusals. The release risk baseline records the
example addresses in the new comments, and the default avatar's, which it
had not. New text is in English, pending Transifex.

Thanks to rzoss and xet7 !

Fixes #1463.
2026-10-08 12:22:43 +03:00
Lauri Ojansivu d560e2fcf8 Make LDAP- and OIDC-synced team members members of the team's boards.
A user added to a team becomes a normal member of the boards that team is
assigned to (#4593, addUserToTeamBoards). The Admin Panel paths did that,
but the login providers' group syncs - LDAP_SYNC_TEAMS and OIDC groups with
PROPAGATE_OIDC_DATA - pushed the team onto the user with a plain $push. Such
users could see the team's boards but not work on them. Both now run the same
board sync after adding a team: LDAP imports it, and the wekan-oidc package,
which cannot import app code, reaches it through a global as it already
reaches authEnv.

tests/teamBoardsFromLoginSync.test.cjs pins both paths and fails if any code
pushes a team onto a user without the board sync; the OIDC concurrency test
now checks each concurrent login syncs only its own team's boards.

Thanks to xet7 !
2026-10-08 11:43:32 +03:00
Lauri Ojansivu 95147fc999 Add an LDAP Sync now button to Admin Panel / People / LDAP.
ldap_sync_now existed in packages/wekan-ldap/server/syncUser.js, but nothing
imported that file, so the method was never defined. It also imported every
directory user regardless of the sync settings. Per the maintainer decision of
2026-10-08 it is now loaded and wired to a Sync LDAP users now button. It runs
the background sync once with the settings in effect: import new users and/or
keep existing users updated, without needing the schedule to be on. Only an
active site administrator can run it, and with neither setting on it says
there is nothing to sync. The button and the scheduled job share one run at a
time, and a failed run reports the directory's error instead of success.

New text is added in English, pending Transifex.

Thanks to xet7 !
2026-10-08 10:59:21 +03:00
Lauri Ojansivu 9d27f4be4d Make LDAP Test connection prove the directory answered without a service account.
ldapts opens its socket lazily. Test connection connected and then bound only
when LDAP_AUTHENTIFICATION was set, so without a service account no operation
ran and it reported success even for a host that does not resolve. Per the
maintainer decision of 2026-10-08 a test without credentials now does an
anonymous base-scope search of LDAP_BASEDN (no attributes, one entry at most)
and succeeds only when the directory answered; otherwise the directory's own
error is shown. Without a base DN it says nothing could be tested.

Thanks to xet7 !
2026-10-08 10:43:35 +03:00
Lauri Ojansivu eb49a4b1b6 Override every login environment variable in Admin Panel / People.
Each login method has its own section: LDAP, OAuth2 (OpenID Connect and
Oracle OIM), CAS and Header login are new or complete, and the Login pane
gets PASSWORD_LOGIN_ENABLED and ACCOUNTS_COMMON_LOGIN_EXPIRATION_IN_DAYS.
models/lib/authConfigCatalog.js lists all 103 variables; server/lib/
authConfig.js resolves each one at run time (Admin Panel value first, then
the environment variable) for the app and, through
globalThis.__wekanAuthEnv, for the wekan-ldap, wekan-oidc and
wekan-accounts-cas packages. OAuth2 and CAS service configurations and LDAP
background sync are reapplied when their settings are saved.

Passwords and client secrets (LDAP_AUTHENTIFICATION_PASSWORD, OAUTH2_SECRET)
never reach the browser: the page learns only whether one is set and where
it comes from. Other values have credentials written inside a URL masked on
the server, and a URL field refuses them.

Fixed on the way:
- The Admin Panel LDAP overrides never applied. The bridge read Settings with
  a server-side findOne(), which Meteor 3 refuses; the error was swallowed and
  the environment used. The settings are now held in an observed cache.
- LDAP Test connection never existed on the server (testConnection.js was not
  imported) and used the synchronous Meteor.user().
- PROPAGATE_OIDC_DATA=false turned the feature on.
- CAS read only the misspelled CASE_VALIDATE_URL; CAS_VALIDATE_URL now works
  and the old name still does.
- snap help named three group-filter keys snap set does not know.

Every catalog variable is now listed in the Dockerfile, the docker-compose
files, snap config and help, and start-wekan.sh/.bat; 14 were missing.
tests/authConfigCatalog.test.cjs pins resolution, secrets, input validation,
platform coverage, and - across the whole tree - that no code reads a login
variable outside the catalog or straight from process.env, and that no
server code calls the synchronous Settings.findOne() or Meteor.user().
tests/playwright/specs/admin-login-env-overrides.e2e.js drives the pages.

Thanks to xet7 !
2026-10-05 19:48:48 +03:00
Lauri Ojansivu dc2e7592a3 Accept nested Active Directory groups in the LDAP group filter.
Since v12.08 (DirectoryGroupBleed) LDAP_USER_AUTHENTICATION=true logins check
LDAP_GROUP_FILTER_ENABLE, which they did not do before. The membership clause
(member=<user DN>) matches direct members only, so in Active Directory, where
access is granted through a team group nested in the access group, legitimate
users were refused, REST clients got 401, and the refusals were listed in
Admin Panel / Problems as ldap.group-denied.

LDAP_GROUP_FILTER_NESTED=true makes both group searches use AD's
LDAP_MATCHING_RULE_IN_CHAIN, (member:1.2.840.113556.1.4.1941:=<user DN>), so
the login filter and admin, role and org/team sync see nested membership. It
is off by default, and an attribute already written as the extensible match
is used as written. The user DN stays escaped, and a user who cannot be named
is still refused without a search.

Documented in LDAP.md with an upgrade note, and added to the Dockerfiles,
docker-compose files, snap config and start-wekan scripts.
tests/ldapNestedGroups.test.cjs drives isUserInGroup and getUserGroups with and
without the setting, and checks that every member clause in ldap.js goes through
groupMemberClause.

Thanks to rmb82 and xet7 !

Fixes #6744.
2026-10-05 18:53:52 +03:00
Lauri Ojansivu c0c6aa5414 Fix SAML account binding to immutable assertion subjects
Resolve accounts by issuer and qualified NameID, refuse rebinding and incomplete legacy identities, and require verified email for opt-in local linking. Persist bindings atomically and report conflicting subjects through the security summary. Cover the login handler with real signed assertions, negative and concurrent-change tests, and extend the browser regression.

Thanks to alham-rizvi and xet7 !

Fixes GHSA-966m-4qgp-j8w4,
2026-10-03 19:01:52 +03:00
Lauri Ojansivu 66925f0bde Show LDAP diagnostics in production when LDAP logging is on.
Everything the LDAP module logged about what it sends and hears - the
client and TLS options, the search options and base DN, the group
filters, why an authentication failed - went to Meteor's Log.debug,
which never prints when Meteor.isProduction. The snap and every bundle
run in production, so turning on ldap-log-enabled showed none of it,
and the search options printed as "[object Object]" in any case. They
now go through the LDAP logger, which prints when LDAP_LOG_ENABLED is
true and redacts secrets, as objects. A failed bind now logs the DN and
the directory's own answer (Active Directory's "data 52e" and the like),
never the password, before it is rethrown.

Thanks to rholighaus and xet7 !

Fixes #6548.
2026-10-02 17:18:23 +03:00
Lauri Ojansivu daf6593adf Verify LDAP server certificates by default.
The Docker image and the snap set LDAP_REJECT_UNAUTHORIZED=false, so an
LDAPS or StartTLS server certificate was not verified unless an admin
changed it, and an empty value disabled verification too. The default is
true everywhere now, and only the exact value false turns it off; a
self-signed or private CA belongs in LDAP_CA_CERT.

Thanks to xet7 !
2026-10-02 14:22:17 +03:00
Lauri Ojansivu d3095fefd6 Accept a CAS callback only from the browser that started that login.
The callback stored the validated CAS identity under whatever casToken its
URL carried, so an attacker could choose a token, get a victim signed in to
CAS to open a CAS login link carrying it, and then log in with that token as
the victim. The starting browser now sets a SameSite cookie with its token
and the callback must present it; a mismatch is recorded under CasBleed in
Admin Panel -> Problems. A ticket parameter on an instance without CAS is
left to its route.

Thanks to xet7 !
2026-10-02 11:45:43 +03:00
Lauri Ojansivu 1076c08381 Complete InvisibleBleed: every hidden HTML comment is made visible, not only the first.
The fix makes HTML comment markers in rendered card text visible so nothing can
be hidden from readers, but used String.replace with a string pattern, which
replaces only the first occurrence - a second comment stayed hidden, and
DOMPurify then dropped it unseen. Every occurrence is replaced now. The test
applies the real replacement to text with two comments; the negative test fails
on any first-only comment replacement. InvisibleBleed moves from the recorded
gaps to guarded.

Thanks to xet7 !
2026-10-02 11:11:01 +03:00
Lauri Ojansivu b7a3b29a2b Link custom URL schemes only when an administrator lists them.
Admin Panel → Features → URL already stored "automaticLinkedUrlSchemes", but
nothing read it: eight schemes were hardcoded, recognised by linkify, then
refused by markdown-it's validateLink and both sanitizer passes, so none was
ever clickable. The listed schemes now pass all three filters and nothing
else does; the setting is empty by default. javascript, data, vbscript and
similar schemes are never linked, in the app's parser and again inside the
markdown package. A listed scheme opens its application in place rather
than through an empty tab.

Fixes #3218,

Thanks to chrisi51 and xet7 !
2026-09-29 15:57:05 +03:00
Lauri Ojansivu 9486ea3d49 Highlight fenced code blocks in card text with highlight.js.
A fenced block with a known language is coloured by highlight.js; a block
with no or an unknown language stays plain, as before. Both sanitizer passes
keep only hljs-* and language-* classes, only on code and span inside pre,
through a hook added for that call; every other class is still removed.

Thanks to xet7 !
2026-09-29 15:52:01 +03:00
Lauri Ojansivu 911e689d23 Show markdown task-list checkboxes in the card viewer again.
The markdown package rendered "- [ ] Task" as a disabled checkbox, but its
"only a task checkbox" rule sat in a HOOKS config key that DOMPurify does
not have, so it never ran. The card viewer then sanitized the output again
with a config forbidding every input, so no checkbox reached the page, and
forms.css hides bare checkboxes app-wide anyway. Both sanitizer passes now
install a real afterSanitizeAttributes hook for the call that keeps only a
disabled checkbox and removes every other input, and the viewer shows it.
The dead HOOKS keys are removed from all three sanitizer configs.

Refs #2419.

Thanks to rodrigocipriani and xet7 !
2026-09-29 15:30:56 +03:00
Lauri Ojansivu d6503b43f5 Choose which SAML signatures are required and log in by full-page redirect.
SAML 2.0 lets an identity provider sign the Response, the Assertion or
both. WeKan always required a signed Response (node-saml's default, never
overridden), so an identity provider that signs only the Assertion was
rejected with "Invalid document signature" before the Assertion was
checked. Admin Panel -> People -> SAML now has SAML_IDP_PROFILE: standard,
which keeps the previous behaviour, or signed-assertion-redirect, which
requires the Assertion signature instead and logs in by full-page redirect.
SAML_WANT_RESPONSE_SIGNED, SAML_WANT_ASSERTIONS_SIGNED and SAML_LOGIN_FLOW
can each be set on their own; left at Default they follow the profile. A
configuration requiring neither signature is refused, and validation
errors now reach the administrator instead of "Internal server error".

In redirect mode the ACS stores the validated profile under the random
credential token and redirects to /sign-in?samlToken=; the page exchanges
it and opens /. The assertion never enters the address. The token is
remembered in the tab that started the login, and a samlToken that tab did
not start is not exchanged, so a link cannot sign a browser into another
account. Errors return as samlError and are shown on the sign-in page.

A test signs responses with a throwaway key and runs them through the
shipped node-saml; browser tests log in through the fixture identity
provider in both flows. The new message is English, pending Transifex.

Thanks to xet7 !
2026-09-29 13:57:51 +03:00
Lauri Ojansivu 3578e3ef84 Fix SAML response correlation and surface popup failures
Read the validated node-saml inResponseTo property and retain single-use response checks. Forward ACS errors to the sign-in form without exchanging missing credentials.

Verify real signed-response login, replay rejection, popup errors and safe UI text rendering. Document deployment-specific identity mapping.

Thanks to xet7.
2026-09-28 21:41:14 +03:00
Lauri Ojansivu d415e13811 Document authentication security fixes in Upcoming and distinguish SAML replay denials
Credit kta1kri for the LDAP report and record the sibling audit, positive and negative tests, local protocol fixtures and Chromium coverage. Do not classify replay-cache capacity failures as attempted replay.

Thanks to kta1kri and xet7 !
2026-09-27 16:53:07 +03:00
Lauri Ojansivu 679a8b3499 Reject LDAP empty credentials, enforce directory groups and prevent SAML replay
Audit authentication boundaries following GHSA-m87f-f43w-hwmc. Guard both LDAP user-bind paths and the DDP/REST entry point, preserve service-account group lookup, compare CAS groups literally, and require single-use SAML request correlation. Add positive, negative, protocol and browser regressions with Problems summaries.

Thanks to kta1kri and xet7 !
2026-09-27 16:49:39 +03:00
Lauri Ojansivu c3caf87a13 Enforce disabled account status and revoke existing sessions.
Fix InactiveBleed across REST, attachment and export authentication, header login, LDAP token issuance and People account controls. Apply administrator-created account flags before insertion and guard token creation atomically.

Thanks to esbrito81 and xet7 !
2026-09-26 01:27:36 +03:00
Lauri Ojansivu 05f1f0a032 Add SAML administration, metadata and service-provider logout
Provide shared catalog-driven settings controls with environment fallback, live admin overrides, platform configuration and regression coverage. Document the remaining live identity-provider validation requirement.

Thanks to xet7 !
2026-09-25 12:45:30 +03:00
Lauri Ojansivu 4d2951ae20 Fix release telemetry review and login error disclosure
Review 46 changed runtime files and refresh the telemetry inventory without weakening the release gates. Check the inventory locally before release mutations and in regression tests.

Fix CodeQL alerts 543 and 544 in the loopback login fixture with bounded anchored OAuth header parsing and generic HTTP failures. Remove the same stack response from the shipped Sandstorm adapter. Preserve successful signatures and proxy authentication; add malformed-input, negative source and live browser coverage.

Validated macOS ARM64 build, 1577-file source inventory, 42926-file bundle scan, ten OAuth/Sandstorm browser checks and focused security/release tests. Hosted CodeQL has not been rerun.

Thanks to GitHub CodeQL and xet7.
2026-09-23 21:31:14 +03:00
Lauri Ojansivu 4f7d28637e Verify login provider exchanges and fix authentication failures
Exercise local LDAP, OAuth, SAML, CAS, SMTP and proxy identity servers through real WeKan login adapters. Fix optional LDAP mapping, simultaneous provider configuration, SAML certificate and profile mapping, async login controls, CAS callbacks and TOTP retry errors. Require consumption of remaining passwordless codes before issuing sessions.

Validated 34 Chromium integration checks, seven expanded social profile checks and focused Node regression suites on macOS ARM64.

Thanks to xet7 !
2026-09-23 20:31:35 +03:00
Lauri Ojansivu 721805b800 Fix source development startup warnings and browser fixture cleanup
Cache Meteor package transforms, make development DEBUG logging opt-in, and replace legacy CAS URL parsing while preserving callback encoding and custom HTTPS ports. Clean attachment metadata during browser fixture teardown, including failure paths.

Verify six focused Node suites, nine sequential browser checks across Chromium, Firefox and WebKit, and live HTTP requests with deprecation tracing. Document the package cache and verification limits.

Thanks to xet7.
2026-09-20 12:25:56 +03:00
Lauri Ojansivu 896f1222bd Implement audited board usability and accessibility fixes.
Repair relative ordering and destination dialog lifecycles, retain failed operations, and make checklist, rule and attachment controls keyboard accessible. Improve scaled layouts and reuse canonical translated labels.

Add source-execution and Chromium/Firefox regression coverage, including awaiting background persistence before reload. Record implementation decisions and validation limits.

Thanks to xet7 !
2026-09-19 14:00:48 +03:00
Lauri Ojansivu fb66fa95cf Repair browser test flows and Meteor markdown package exports
Expose the renderer through a Meteor main module, synchronize security settings without repeated reactive invalidation, and route canonical avatar downloads around the automatic Meteor-Files handler. Update browser tests for the visible Board View and list menus, correct fixture IDs and authentication headers, and wait for the settings publication where direct Mongo updates are used.
2026-09-15 12:10:40 +03:00
Lauri Ojansivu 2c5cdd78a9 Handle unset optional LDAP user search filter
An unset LDAP_USER_SEARCH_FILTER was indexed after service-account binding, causing the reported undefined index TypeError instead of searching users. Preserve configured filters and reject invalid types explicitly.

Thanks to Nissulya and xet7 !

Fixes #6692,
2026-09-14 13:52:37 +03:00
Lauri Ojansivu 5f5822f7d0 Preserve actionable redacted LDAP bind errors
LDAP errors were serialized as empty objects because their name and message are non-enumerable. Preserve diagnostic name, message, code and reason through the existing secret sanitizer. Verify certificate and credential diagnostics plus disabled logging.

Thanks to Nissulya and xet7 !

Refs #6692
2026-09-14 12:21:37 +03:00
Lauri Ojansivu 71b77aedad Align selected-calendar month grids with the configured week start 2026-09-13 14:30:53 +03:00