mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-17 04:12:17 +03:00
Merged as part of the owner batch of 2026-09-11. This PR had a live worktree in another session, so it sat outside the main 39. Merged on your explicit call, validated first rather than taken on trust: boarded with the other 10 worktree-held PRs into a consolidated worktree off `release/v3.8.51`. - ESLint over every changed file: no errors - `typecheck:core` clean; `check:dashboard-typecheck` OK; `check:changelog-integrity` OK - complexity 2821 / baseline 3218 and cognitive-complexity 1272 / baseline 1437 - 203 of 208 assertions green. The 5 remaining (`guide-settings-route` ×4, `hard-session-lease-bypass-inventory` ×1) reproduce on the pure tip with nothing from this batch applied. - `imageGeneration.ts` rebaselined 3259 → 3293 for #12945's image-only-model guard, landed separately in #13392 so nothing was pushed onto a live branch. ⚠️ base-red inherited: #12732 — provider count 356 vs 358 and `open-sse/utils/stream.ts` 3115 > frozen 3098, both reproducing on the pure tip.
47 lines
1.7 KiB
TypeScript
47 lines
1.7 KiB
TypeScript
import { test } from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { buildRunArgs, sessionKey } from "@/lib/vncSession/service";
|
|
import { VNC_CONFIG } from "@/lib/vncSession/manifest";
|
|
|
|
test("buildRunArgs (#12571) injects the CDP bridge token and a non-default network", () => {
|
|
const args = buildRunArgs({
|
|
containerName: sessionKey("session-abc"),
|
|
sessionId: "session-abc",
|
|
connectionId: "connection-xyz",
|
|
profileDir: "/tmp/profile",
|
|
chromeCli: "--remote-debugging-port=9222 https://example.com",
|
|
cdpToken: "super-secret-token",
|
|
});
|
|
|
|
const networkIndex = args.indexOf("--network");
|
|
assert.ok(networkIndex >= 0, "docker run args must include --network");
|
|
assert.equal(args[networkIndex + 1], VNC_CONFIG.network);
|
|
assert.notEqual(
|
|
args[networkIndex + 1],
|
|
"bridge",
|
|
"must not join Docker's default bridge network (#12571)"
|
|
);
|
|
|
|
const envFlags = args.filter((_value, index) => args[index - 1] === "-e");
|
|
assert.ok(
|
|
envFlags.some((flag) => flag === "CDP_BRIDGE_TOKEN=super-secret-token"),
|
|
"docker run args must inject CDP_BRIDGE_TOKEN for the container's cdp-bridge.py"
|
|
);
|
|
});
|
|
|
|
test("buildRunArgs (#12571) generates a distinct token per call so sessions cannot reuse each other's secret", () => {
|
|
const base = {
|
|
containerName: "c",
|
|
sessionId: "s",
|
|
connectionId: "conn",
|
|
profileDir: "/tmp/p",
|
|
chromeCli: "--x",
|
|
};
|
|
const argsA = buildRunArgs({ ...base, cdpToken: "token-a" });
|
|
const argsB = buildRunArgs({ ...base, cdpToken: "token-b" });
|
|
|
|
assert.ok(argsA.includes("CDP_BRIDGE_TOKEN=token-a"));
|
|
assert.ok(argsB.includes("CDP_BRIDGE_TOKEN=token-b"));
|
|
assert.notDeepEqual(argsA, argsB);
|
|
});
|