diff --git a/CHANGELOG.md b/CHANGELOG.md index e9a10bcd24..23240ceebe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ### 🔧 Bug Fixes - **services (installer):** fix `spawn EINVAL` when installing an embedded service (9Router / CLIProxy) on **Windows + Node.js 24+**. Node 24 stopped letting `child_process.execFile()` run `.cmd` batch files without a shell (nodejs/node#52554), and npm on Windows is `npm.cmd`, so `runNpm()` threw `EINVAL` the moment a user clicked **Install**. `runNpm` now enables `shell` on win32 only. To keep Hard Rule #13 intact under a shell — where the shell, not `execFile`, parses argv — the install `--prefix` (a `DATA_DIR` path that can legitimately contain spaces, e.g. `C:\Users\John Doe\.omniroute\…`) is now passed via the `npm_config_prefix` **environment variable** instead of an argv path, and the user-supplied install `version` is constrained to a dist-tag/semver shape (`SERVICE_VERSION_PATTERN`) at the route boundary so it can never carry shell metacharacters. With the prefix in the environment and the version validated, every remaining argv entry is a static flag. Regression guards: `tests/unit/services/installers/runNpm-shell-5379.test.ts` (+ existing `ninerouter.test.ts` aligned to npm's `npm_config_prefix` env). ([#5379](https://github.com/diegosouzapw/OmniRoute/issues/5379)) +- **cli (serve):** restore `dist/tls-options.mjs` to the npm tarball — the opt-in native HTTPS/TLS sidecar (#5361) was copied into the staged `dist/` by the build but then **pruned** by the prepublish allowlist step, so `omniroute serve` crashed on the published 3.8.41 with `ERR_MODULE_NOT_FOUND` (`dist/server-ws.mjs` imports `./tls-options.mjs`). Added `tls-options.mjs` to `APP_STAGING_ALLOWED_EXACT_PATHS` (survives the prune) and `dist/tls-options.mjs` to `PACK_ARTIFACT_REQUIRED_PATHS` (the `check:pack-artifact` gate now fails loudly if it ever vanishes again — same guard pattern as `webdav-handler.mjs`). Regression guards in `tests/unit/pack-artifact-policy.test.ts`. ([#5452](https://github.com/diegosouzapw/OmniRoute/issues/5452)) --- diff --git a/scripts/build/pack-artifact-policy.ts b/scripts/build/pack-artifact-policy.ts index ba0451059e..6b0cb27a7e 100644 --- a/scripts/build/pack-artifact-policy.ts +++ b/scripts/build/pack-artifact-policy.ts @@ -47,6 +47,11 @@ export const APP_STAGING_ALLOWED_EXACT_PATHS: string[] = [ "scripts/dev/tls-options.mjs", "server.js", "server-ws.mjs", + // #5452: dist/tls-options.mjs is copied by assembleStandalone (EXTRA_MODULE_ENTRIES) + // and imported by dist/server-ws.mjs for opt-in native HTTPS/TLS (#5361). Without + // this bare entry the prepublish prune (Step 10.7) deletes it → `omniroute serve` + // crashes with ERR_MODULE_NOT_FOUND (regressed in the published 3.8.41 tarball). + "tls-options.mjs", "webdav-handler.mjs", ]; @@ -144,6 +149,9 @@ export const PACK_ARTIFACT_REQUIRED_PATHS: string[] = [ "dist/responses-ws-proxy.mjs", "dist/peer-stamp.mjs", "dist/http-method-guard.cjs", + // #5452: regression guard — make check:pack-artifact fail loudly if the TLS + // opt-in sidecar (imported by dist/server-ws.mjs) ever vanishes from the tarball. + "dist/tls-options.mjs", "dist/webdav-handler.mjs", "bin/cli/program.mjs", "bin/mcp-server.mjs", diff --git a/tests/unit/pack-artifact-policy.test.ts b/tests/unit/pack-artifact-policy.test.ts index cb37b2b66f..098ac4483e 100644 --- a/tests/unit/pack-artifact-policy.test.ts +++ b/tests/unit/pack-artifact-policy.test.ts @@ -64,6 +64,22 @@ test("webdav-handler.mjs is allowed in staging dist/ (server-ws.mjs dependency, assert.deepEqual(unexpectedPaths, []); }); +test("tls-options.mjs is allowed in staging dist/ (server-ws.mjs dependency, missed in 3.8.41 build — #5452)", () => { + const unexpectedPaths = findUnexpectedArtifactPaths(["tls-options.mjs"], { + exactPaths: APP_STAGING_ALLOWED_EXACT_PATHS, + prefixPaths: APP_STAGING_ALLOWED_PATH_PREFIXES, + }); + assert.deepEqual(unexpectedPaths, []); +}); + +test("dist/tls-options.mjs is a required tarball path (regression guard for #5452)", () => { + const missingPaths = findMissingArtifactPaths([], PACK_ARTIFACT_REQUIRED_PATHS); + assert.ok( + missingPaths.includes("dist/tls-options.mjs"), + "dist/tls-options.mjs must be enforced by the pack-artifact gate" + ); +}); + test("setupPolyfill.ts is allowed in the tarball (bin/omniroute.mjs imports it at startup)", () => { const unexpectedPaths = findUnexpectedArtifactPaths(["open-sse/utils/setupPolyfill.ts"], { exactPaths: PACK_ARTIFACT_ALLOWED_EXACT_PATHS, @@ -98,6 +114,7 @@ test("findMissingArtifactPaths flags missing root runtime files in the tarball", "dist/peer-stamp.mjs", "dist/responses-ws-proxy.mjs", "dist/server-ws.mjs", + "dist/tls-options.mjs", "dist/webdav-handler.mjs", "scripts/build/colocateOptionals.mjs", "scripts/build/native-binary-compat.mjs",