Commit Graph
6 Commits
Author SHA1 Message Date
Lauri Ojansivu 4caa929cfe Fix CodeQL alerts 562, 563 and 564, and the same shapes elsewhere.
Alert 564 (regex injection): releases/platform-native-packages.mjs compiled
its command-line platform and arch into a RegExp. The canvas package names
are now compared as strings. The upload naming of attachments and avatars,
the attachment rename popup and tools/mirror-menu.mjs built a RegExp from a
file extension or a name the same way; they use literal suffix and prefix
checks now. tests/noUnescapedDynamicRegExp.test.cjs parses every source file
and fails on a RegExp built from a value that is not escaped, unless the
site is listed with the reason its values are constants.

Alert 563 (incomplete escaping): name.replace('/', '%2F') replaced only the
first slash. registryPackagePath() replaces every one and refuses anything
that is not an npm package name. Seven tests escaped a regex the same
first-only way; 'g++'.replace('+', '\\+') let "- g+" pass a guard. They use
the complete escapeRegExp, and tests/noIncompleteRegExpEscaping.test.cjs
fails on any string-pattern replace that performs an escape.

Alert 562 (ReDoS): the CasaOS reverse-domain id pattern in
tests/platformTemplates.test.cjs let '.' be matched by both groups, so
'0.0.0...!' backtracked exponentially. Each separator now belongs to one
group, and the test runs CodeQL's attack string against it.

Thanks to GitHub CodeQL and xet7 !
2026-10-12 02:18:33 +03:00
Lauri Ojansivu 34a33f7b14 Windows win32 and ARM64 bundles: compile bcrypt and argon2 with node-gyp itself.
v12.33's build-win32 and build-win-arm64 both failed their addon check:

  ...accounts-password/node_modules/argon2 has no arm64 Windows addon to load

The jobs relied on npm to compile the addons that have no prebuild for their
CPU (argon2 0.44 for win32-arm64; bcrypt and argon2 for win32-ia32) during
the programs/server install, through Meteor's npm-rebuild.js. The release
jobs use npm 12, which ignores npm_config_arch, npm_config_target_arch and
npm_config_nodedir ("Unknown env config", which it says will become an
error) and blocks install scripts outside allowScripts ("install scripts
blocked"). So nothing was compiled.

releases/compile-native-addons.mjs now runs node-gyp itself, using the
node-gyp that the install brings (pinned to 13.x, which finds Visual
Studio 2026), with --arch for the target CPU. win32 also passes the nodedir
that holds the fork's ia32 node.lib. It does this for every copy of each
named package that has a binding.gyp and no win32-<arch> prebuild, before
prune-build-only-modules removes node-gyp. It fails if node-gyp fails or
leaves no .node. Both jobs no longer set the npm_config_ variables.

Checked with the real node-gyp 13.0.2, argon2 0.44.0 and bcrypt 6.0.0
(with their win32 prebuilds removed, compiled for this machine): both
compiled, loaded, and hashed and verified a password.
tests/compileNativeAddons.test.cjs covers the plan, the node-gyp arguments
and every way the compile could quietly not happen.
tests/win32BundleBuild.test.cjs pins the step in both jobs and refuses
npm_config_arch/_target_arch/_nodedir in any workflow.
tests/releaseBundleCoverage.test.cjs used to require npm_config_arch: ia32,
and now requires the node-gyp cross-build, with the reason recorded in the
test.

Thanks to xet7 !
2026-10-11 23:34:51 +03:00
Lauri Ojansivu 242c4b097c Sandstorm uses the same Node.js, npm and FerretDB as other platforms.
The .spk now carries the exact Node.js the Dockerfile pins (26.11.1), which
is what https://wekan.fi/version.txt advertises, downloaded and verified
with releases/embed-verified-node.sh like the zip bundles, instead of
Meteor's dev-bundle node or the newest Node 24. FerretDB is fetched by the
release tag version.txt names, and the Sandstorm and Windows workflows
install the Dockerfile's npm with releases/use-release-npm.sh instead of a
hard-coded npm 12.0.2. Comments and docs describing the current runtime
say Node 26.

Thanks to xet7 !
2026-10-11 13:12:21 +03:00
Lauri Ojansivu ed4b8cd648 RouteBleed: remove incomplete route-pattern escaping.
CodeQL alert #434 found that boardExportScope escaped only forward slashes before interpolating an export path into a RegExp. Replace the pattern with an exact route-literal inclusion check, so there is nothing to escape and metacharacters cannot change the match.

Add positive and negative cases with backslashes and regex metacharacters, reject the reported partial-escape shape across tracked JavaScript, and remove a second partial dynamic pattern from release bundle coverage. This was test-only code with no runtime request path, so there is no attributable attempt for Admin Panel Problems.

Thanks to GitHub CodeQL code scanning and xet7 !
2026-08-17 14:50:07 +03:00
Lauri Ojansivu d093486766 Native bundles: authenticate the fork-version lookup, tolerate a missing checksum, and cross-build win32 ia32.
Three separate native-bundle failures in one release run:

* mac-arm64 failed the major->tag resolution. embed-verified-node.sh and
  check-arch-binaries.sh call api.github.com to find the fork's newest v24.x tag,
  but no step passed a token, so the call was UNauthenticated - 60 requests/hour
  per IP, shared across runners - and 403-rate-limited intermittently. That is why
  amd64 (which ran first) resolved fine while mac-arm64 (later) did not. A
  workflow-level GITHUB_TOKEN: ${{ github.token }} authenticates every such call
  (5000/hour), fixing the native jobs and the extra-arch preflight alike.

* win64 failed because the fork published node-win64.exe WITHOUT its
  node-win64.exe.sha256sum, and the embed helper 404'd on the sidecar. The
  checksum is a belt-and-suspenders check on top of an already-authenticated HTTPS
  download from the fork, so a MISSING one is now a warning and the binary ships
  UNVERIFIED (a checksum that is present and does NOT match is still fatal). This
  matches how check-arch-binaries.sh already treats a missing fork checksum.

* win32 failed at setup-node: "Unable to find Node version '24' for platform win32
  and architecture x86" - there is NO 32-bit Windows Node 24 (the reason the fork
  exists). It now runs the runner's x64 Node to DRIVE node-gyp and cross-builds
  the native modules (bcrypt) to ia32 via npm_config_arch=ia32; the shipped
  node.exe is still the fork's 32-bit node-win32.exe. tests/releaseBundleCoverage
  is updated for the ia32 cross-build.

Thanks to xet7 !
2026-08-05 17:38:53 +03:00
Lauri Ojansivu bff53e93ad Add the win32 and mac-x64 .zip bundles, so every wekan/node fork platform has a WeKan bundle.
The wekan/node fork builds Node.js for 13 platforms and WeKan takes its Node.js
only from the fork, so every one of those platforms should have a WeKan .zip
bundle. Twelve did; 32-bit Windows (win32) and Intel macOS (mac-x64) did not -
the fork builds node-win32.exe and node-mac-x64 (nodejs.org has neither a 32-bit
Windows nor, going forward, a place WeKan will take Intel macOS from), but there
was no job to turn them into bundles. This adds both.

build-win32 mirrors build-win64 on a windows runner, with two differences: it
installs a 32-bit (x86) Node via setup-node so the native modules it rebuilds
(bcrypt) are ia32, matching the fork's 32-bit node.exe the bundle ships, and it
takes ferretdb-win32.exe. build-mac-x64 mirrors build-mac-arm64 on a macos-13
Intel runner, taking node-mac-x64 and ferretdb-mac-amd64.

Both are BEST-EFFORT: a preflight step checks whether the fork has published the
platform's node binary for this version and, if not, SKIPS the job with a warning
instead of a red failure - the fork builds these on its own schedule, and the
bundle appears the run after the fork publishes the binary. Every build step is
gated on that skip. release-notes waits for both so their provenance rows land in
the table. tests/releaseBundleCoverage.test.cjs pins that all six native fork
assets and all seven extra-arch legs map to a bundle; the cpu-exec and snap-arch
guards learn about the two new non-Linux bundles and the armv7 leg.

Thanks to xet7 !
2026-08-04 21:37:17 +03:00