Files
OmniRoute/tests/unit/tailscale-validation.test.ts
Paco Cartones 436ce4869f fix(tailscale): validate ports and quote MSI paths (#11534)
Validated in a combined 10-PR batch worktree off release/v3.8.51 tip.
- Focused test: tests/unit/tailscale-validation.test.ts — 2/2 pass plus 13/13 related Tailscale tests
- typecheck:core, file-size, changelog-integrity, complexity, cognitive-complexity gates — all OK
- Full-repo lint: 503 pre-existing problems confirmed identical on the pure release/v3.8.51 tip — unrelated to this diff

⚠️ base-red inherited: #11449

Thanks for rejecting out-of-range Tailscale ports and escaping apostrophes before they reach the Windows MSI installer PowerShell command.
2026-08-25 13:12:38 -03:00

20 lines
966 B
TypeScript

import assert from "node:assert/strict";
import test from "node:test";
import { tailscaleEnableSchema } from "../../src/app/api/tunnels/tailscale/routeUtils.ts";
import { buildWindowsTailscaleInstallCommand } from "../../src/lib/tailscaleTunnel.ts";
test("tailscale enable accepts only valid TCP ports", () => {
assert.equal(tailscaleEnableSchema.safeParse({ port: 1 }).success, true);
assert.equal(tailscaleEnableSchema.safeParse({ port: 65535 }).success, true);
assert.equal(tailscaleEnableSchema.safeParse({ port: 0 }).success, false);
assert.equal(tailscaleEnableSchema.safeParse({ port: 65536 }).success, false);
});
test("Windows installer command escapes apostrophes in MSI paths", () => {
assert.equal(
buildWindowsTailscaleInstallCommand("C:\\Users\\O'Brien\\tailscale-setup.msi"),
"Start-Process msiexec -ArgumentList '/i','C:\\Users\\O''Brien\\tailscale-setup.msi','TS_NOLAUNCH=true','/quiet','/norestart' -Verb RunAs -Wait"
);
});