Commit Graph
8 Commits
Author SHA1 Message Date
Lauri Ojansivu c35c672ffb Single-file: the 32-bit host Node.js is the target bundle's exact version.
The v13.07 single files for armhf, armv6 and armv7 all stopped on "The
bundle's Node.js is v26.13.0 but this is v26.13.1: a single executable must
be built by the same Node.js version it embeds." A 32-bit target's SEA blob is
written by a 32-bit Node.js, and the workflow borrowed the i386 bundle's.
Every bundle takes the newest Node.js of the pinned major its platform has, so
i386 had v26.13.1 from wekan/node-patches while 32-bit ARM still had v26.13.0.

The host is now resolved with releases/resolve-node-source.sh at the target
bundle's exact version, checked against its published SHA256, and refused
unless it reports that version. libatomic1:i386, which the bundle used to
supply in node-runtime/, comes from apt, so HOST_LIBS is gone.

tests/singleFile.test.cjs pins the exact version, the checksum before the
first run, and that the host is never taken from another platform's bundle.

Thanks to xet7 !
2026-11-12 16:05:46 +02:00
Lauri Ojansivu 081690875d Tests: the real single executable test says why it cannot run on a kernel with large pages.
On Linux, --build-sea injects the SEA blob with LIEF, which adds PT_LOAD
segments aligned to 4 KiB. A kernel with 16 KiB pages (Apple-silicon Linux)
or 64 KiB pages (some ARM servers) cannot map them, and the executable dies
with SIGSEGV before it runs a line. A one-line console.log SEA built with
Node.js v26.13.0 crashes the same way, so it is the injection, not WeKan.
The test failed there as `null !== 0`, which said nothing; it is now skipped
when the page size is over 4 KiB, with that reason. Release builders have
4 KiB pages, so they still run it.

Thanks to xet7 !
2026-11-06 16:15:34 +02:00
Lauri Ojansivu 8d4f4caa2f Single file: a macOS build is signed whatever its target is called, and start/backup return once WeKan runs.
EVERYTHING's node suites run under Meteor's Node.js, which has single
executable applications, so singleFile.test.cjs built and ran a real
single executable - and it failed twice:

- The builder ad-hoc signed only a target named mac*/darwin*. Built from
  this Mac's Node.js under another label (the test builds 'amd64'), the
  file is still a Mach-O binary, the injected archive had invalidated its
  signature, and macOS killed it (SIGKILL) before it printed anything:
  status null. It signs every Mach-O output now, read from the file's
  magic number.
- `start --background` and `backup` returned as soon as they had spawned
  WeKan, before it wrote its pid file - which it does only after reading
  its settings and extracting FerretDB. A `stop` right after them said
  "WeKan was not running" and left it running. Both wait now
  (status.waitUntilStarted) until the pid file names the process they
  started, give up at once if it ended, and say so if it did not start.

singleFile.test.cjs: 24 of 24 under Meteor's Node.js, the real single
executable included; a new test pins waitUntilStarted, and that both
commands use it.

Thanks to xet7 !
2026-11-01 02:23:36 +02:00
Lauri Ojansivu 43e09631c4 Single file: a Node.js without single executable applications is named; tests run on an arm64 Mac.
A Node.js can be compiled without single executable applications - the
Homebrew one on macOS is - and `node --build-sea` then only says "Single
executable application is disabled" and exits 9, which the build
reported as a bare failed command. build.mjs asks first (seaSupported) and
stops with what to do: build with a Node.js from nodejs.org, given with
--host-node.

tests/singleFile.test.cjs skips the end-to-end build on such a Node.js
and says why, tests seaSupported against stand-ins of both kinds, and
expects the 32-bit refusal to name the host's own arch - it expected
"x64", so it failed on an arm64 Mac.

Thanks to xet7 !
2026-10-27 23:06:49 +02:00
Lauri Ojansivu 0966a90d39 Windows single files start: Meteor's paths, and 32-bit targets built by a 32-bit Node.js.
The win64, win-arm64 and win32 single files stopped at once since v12.41,
for two reasons:

- win64 and win-arm64: Node.js mounts the archive at \\.\NUL\vfs\<n>, and
  Meteor's mini-files.js turns a path beginning with a backslash into
  C:\... - so Npm.require looked in the wrong place and the server
  stopped with "Cannot find module 'denque'". The single file now carries
  mini-files.js patched to keep a UNC or device path (two leading
  separators) as it is; drive paths are unchanged, and the build stops if
  Meteor's code is not the code the patch was written for. It also makes
  a bundle runnable from a \\server\share.
- win32: the SEA blob stores its lengths as size_t, so a blob written by
  the x64 Node.js on the build host is unreadable to a 32-bit node.exe
  (createZipProvider got no archive). build.mjs now refuses a target whose
  pointer width differs from its builder's, and single-file.yml builds
  win32, i386 and 32-bit ARM with the release's i386 Node.js, checksum
  verified - the i386 and ARM ones had the same fault but no runner starts
  them.

tests/singleFile.test.cjs runs Meteor's path functions on Windows path
semantics before and after the patch, refuses win32 from x64, and builds
and starts a real single executable with the patched file.

Thanks to xet7 !
2026-10-14 19:28:27 +03:00
Lauri Ojansivu 587efab82b Fix GitHub CodeQL alerts #584 and #585.
#584 (bad HTML filtering regexp): tests/accountEmailHtml.test.cjs checked
that the e-mail layout escapes markup with /<img|<script|<b>/, which a
<SCRIPT> passes. It now lists every tag in the output, in any letter case,
and allows only the layout's own div, p, a and br; an upper- and mixed-case
input is tried as well. The renderer was already escaping them.

#585 (incomplete regular expression for hostnames): the same test made the
reset address into a RegExp; it compares the text instead.

Both are pinned as shapes in tests/securityAlerts20261012.test.cjs, which
found more of them: a case-sensitive <script> pattern in jsWebLabels.test.cjs,
a path spliced into generated code in singleFile.test.cjs (now passed through
the child's environment), and twelve test patterns with a host name's dot
unescaped. No regex literal in the tree leaves one unescaped now.

These are in tests, so there is no attempt at runtime to record in Admin
Panel -> Problems.

Thanks to GitHub CodeQL and xet7 !
2026-10-14 16:43:00 +03:00
Lauri Ojansivu 2352f1f44f Fix GitHub CodeQL alerts #570-#580.
#570, #571 (incomplete multi-character sanitization): email to card
turned an HTML-only email into text with one pass of each removal, so a
script element spliced together by removing an inner one survived and its
contents reached the card ("<scr<script></script>ipt>alert(1)</script>").
Both removals now run to a fixed point.

#574 (regular expression injection): the single file's wekan.env writer
spliced the setting name into a RegExp. A setting must be an environment
variable name, is compared literally, and its value must be one line. The
kept-versions reader built a half-escaped RegExp from the file extension;
it now reads wekan-<version><exe> literally.

#572, #573 (incomplete string escaping): two runtime tests escaped only
some metacharacters; they compare literally now. #575-#580 (URL substring
and hostname patterns): translation tests matched example hostnames with
unescaped dots or substring checks; the dots are escaped and the hosts
bounded.

tests/tagStrippingFixedPoint.test.cjs missed the <[^>]+> spelling; it now
catches both, accepts a fixed-point helper only when it really loops, and
records the search-index text of server/lib/documentGif.js as never
rendered. tests/emailToCard.test.cjs fails on the old htmlToText;
tests/singleFile.test.cjs refuses regex and newline input in setting
names and values, and reads only real version files.

Nothing here is an attempt a user can make at runtime that the server
refuses, so there is no Admin Panel / Problems key to add.

Thanks to GitHub CodeQL and xet7 !
2026-10-14 07:35:20 +03:00
Lauri Ojansivu 31e569a18e Single-file WeKan for every platform with a Node.js bundle.
One executable per platform: that platform's published bundle repackaged
as a Node.js single executable application whose ZIP Node 26.11 mounts as
a virtual file system (useVfs + vfsArchive). Only FerretDB is copied out,
once and verified, to wekan-files/bin; native addons load from the VFS.

Everything WeKan writes is in wekan-files beside the executable, which
WRITABLE_PATH points at: attachments, avatars, db, bin, backup, logs,
versions. WeKan now treats a WRITABLE_PATH named wekan-files as the files
root (models/lib/filesRoot.js, shared by every place that derived it).

Started in a terminal it shows a menu: start, stop, status, version info
as Admin Panel / Version shows it, update to the newest release or change
to any other (checksum verified, backed up first, the old executable
kept), backup to wekan-files/backup/YYYY-MM-DD_HH-MM-SS, run at boot
(systemd, launchd, Task Scheduler, cron, Termux:Boot), log, settings.
Every entry is also a command. start runs the start-wekan.sh loop:
recovery, requested restore, FerretDB, recovery page, WeKan, restart.

Meteor's main.js chdir()s into the bundle, which a VFS cannot be, so the
server role keeps a virtual working directory. Node 26.11.1 breaks
fs.writev/readv while any VFS is mounted; they are rebuilt on fs.write
and fs.read.

single-file.yml builds every target in releases/single-file/targets.json
from its verified bundle (Macs on a Mac, to re-sign), starts it where a
runner exists with browser tests on amd64, and attaches what started.
Release All and Release All Missing call it.

Thanks to xet7 !
2026-10-13 21:08:09 +03:00