diff --git a/docs-site/src/content/docs/guides/remote-link.md b/docs-site/src/content/docs/guides/remote-link.md index 55a2b72919a..577081dfb2f 100644 --- a/docs-site/src/content/docs/guides/remote-link.md +++ b/docs-site/src/content/docs/guides/remote-link.md @@ -15,6 +15,8 @@ A machine link connects an OpenCodex **Home** computer to a **Child** computer o Password SSH is not supported. Links can be started from Home or Child. Windows execution uses PowerShell over the same pinned OpenSSH connection. +On Linux, a recorded OpenCodex install is used only when its executable and optional package entrypoint belong to the SSH account and their permissions and parent directories prevent replacement by another account. If that cannot be checked, Remote Link skips the recorded install. On macOS, recorded installs are always skipped because the remote shell cannot reliably verify their extra access permissions (ACLs). Remote Link continues its existing Desktop, system and PATH discovery on both platforms. A macOS install available only through the runtime record therefore needs to be installed in a discoverable location or added to the SSH account’s PATH. Keep the installation in an account-owned directory instead of a shared writable folder; a successful version response alone does not establish ownership. + ## Add a Child from `#remote` 1. Open the dashboard at `#remote` and switch Remote Link on. diff --git a/docs-site/src/content/docs/ko/guides/remote-link.md b/docs-site/src/content/docs/ko/guides/remote-link.md index 4b295cd2a42..9596ddf8856 100644 --- a/docs-site/src/content/docs/ko/guides/remote-link.md +++ b/docs-site/src/content/docs/ko/guides/remote-link.md @@ -114,6 +114,8 @@ disconnect는 소유한 키만 복구하므로 이후 편집한 모델·훅·신 ## 보안 +Linux에서는 기록된 OpenCodex 설치의 실행 파일과 패키지 진입 파일이 SSH 계정 소유이며, 파일 권한과 상위 폴더가 다른 계정의 교체를 막는 경우에만 사용합니다. 이를 확인할 수 없으면 해당 기록을 건너뜁니다. macOS에서는 원격 셸이 추가 접근 권한(ACL)을 확실하게 확인할 수 없으므로 기록된 설치를 항상 건너뜁니다. 두 플랫폼 모두 기존 Desktop·시스템·PATH 탐색을 계속합니다. macOS에서 실행 기록으로만 찾을 수 있던 설치는 탐색 가능한 위치에 설치하거나 SSH 계정의 PATH에 추가해야 합니다. 설치 파일은 여러 계정이 수정할 수 있는 공유 폴더 대신 계정 소유 폴더에 두세요. 버전 응답에 성공했다는 사실만으로 소유권이 확인되지는 않습니다. + Child는 링크를 통해 Home 컴퓨터의 프로바이더와 프로바이더 인증 정보를 사용합니다. Home은 Child마다 별도의 링크 키를 만들며, 링크를 제거하면 그 키를 폐기합니다. 확인 전에 호스트 지문을 비교하여 잘못된 컴퓨터나 변경된 호스트 키를 실수로 허용하지 않도록 하세요. Tailscale identity로 발급된 대시보드 세션은 머신 링크를 관리할 수 없습니다. Child에서 키는 OpenCodex 안에만 머뭅니다. Codex나 Claude Code가 Child에서 보내는 인증 정보는 Home으로 전달되지 않으며, Child에서 `127.0.0.1:`에 접근하는 프로그램은 키 없이 Home을 사용합니다. 이는 독립형 설치가 로컬 프로그램에 주는 것과 같은 신뢰 수준입니다. 다른 사이트의 웹 페이지는 거부됩니다. ## CLI 레퍼런스 diff --git a/scripts/test-layout/layout-clients.json b/scripts/test-layout/layout-clients.json index 621543f11d4..e2bfa0fa3ab 100644 --- a/scripts/test-layout/layout-clients.json +++ b/scripts/test-layout/layout-clients.json @@ -1,4 +1,5 @@ { + "link-served-runtime-trust.test.ts": "clients", "claude-endpoint-lifetime.test.ts": "claude-integration", "omo-responses-loop.test.ts": "clients", "codex-launcher-endpoint.test.ts": "codex-integration", diff --git a/src/link/remote-runtime-trust.ts b/src/link/remote-runtime-trust.ts new file mode 100644 index 00000000000..d116b656ff2 --- /dev/null +++ b/src/link/remote-runtime-trust.ts @@ -0,0 +1,69 @@ +/** + * POSIX census targets are hints, not execution authority. Walk each path before its + * first version probe, including symlink destinations and directory replacement + * authority. Only root and the SSH account may control traversed components; the + * final regular file must belong to the SSH account and have no foreign write bit. + * Sticky shared directories are safe only with the same ownership checks on their + * children. Keep the verified original spelling so package-prefix discovery and + * interpreter entrypoint semantics remain unchanged. + * macOS recorded hints are skipped: mode bits miss ACL grants and system ls can + * conceal ACL read failures. Its existing known-install discovery still runs. + * These checks do not defend against root or unrestricted same-account mutation. + */ +export const REMOTE_SERVED_PATH_TRUST = `served_path_info() { + stat -c '%u %a' "$1" 2>/dev/null || stat -f '%u %Mp%03Lp' "$1" 2>/dev/null +} +trusted_served_path() ( + case "$1" in /*) ;; *) return 1;; esac + # A portable shell cannot prove macOS ACL protection from stat/ls output. + [ "$(uname -s 2>/dev/null)" = Linux ] || return 1 + served_uid=$(id -u 2>/dev/null) || return 1 + case "$served_uid" in ''|*[!0-9]*) return 1;; esac + original=$1; pending=\${1#/}; resolved=/; steps=0; links=0 + # The root is trusted only after the same ownership/mode validation as each directory. + component=/ + while :; do + steps=$((steps + 1)); [ "$steps" -le 512 ] || return 1 + info=$(served_path_info "$component") || return 1 + case "$info" in ''|*[!0-9[:blank:]]*) return 1;; esac + set -- $info + [ "$#" -eq 2 ] || return 1 + case "$2" in ''|*[!0-7]*) return 1;; esac + [ "\${#2}" -le 4 ] || return 1 + [ "$1" = "$served_uid" ] || [ "$1" = 0 ] || return 1 + if [ -L "$component" ]; then + links=$((links + 1)); [ "$links" -le 40 ] || return 1 + # Preserve trailing newlines in a link target instead of validating a different path. + target=$(readlink "$component" 2>/dev/null && printf '.') || return 1 + target=\${target%.} + case "$target" in *' +') target=\${target%?};; *) return 1;; esac + case "$target" in ''|*' +'*) return 1;; esac + [ -z "$pending" ] || target=$target/$pending + case "$target" in /*) resolved=/; pending=\${target#/};; *) pending=$target;; esac + elif [ -d "$component" ]; then + # Group/world write is allowed only on a trusted sticky directory. Its next + # entry must still be root/account-owned, so another account cannot replace it. + [ $((0$2 & 0022)) -eq 0 ] || [ $((0$2 & 01000)) -ne 0 ] || return 1 + resolved=$component + else + [ -z "$pending" ] && [ -f "$component" ] || return 1 + [ "$1" = "$served_uid" ] && [ $((0$2 & 0022)) -eq 0 ] || return 1 + printf '%s\\n' "$original" + return 0 + fi + while :; do + [ -n "$pending" ] || return 1 + name=\${pending%%/*} + case "$pending" in */*) pending=\${pending#*/};; *) pending=;; esac + case "$name" in + ''|.) continue;; + ..) resolved=\${resolved%/*}; [ -n "$resolved" ] || resolved=/; continue;; + esac + component=\${resolved%/}/$name + break + done + done +) +`; diff --git a/src/link/ssh-argv.ts b/src/link/ssh-argv.ts index 4cac04bdf3e..bffbc96f288 100644 --- a/src/link/ssh-argv.ts +++ b/src/link/ssh-argv.ts @@ -21,6 +21,7 @@ import { isRouteClientId, type RouteClientId } from "./route-intent"; import { isAbsolute } from "node:path"; import { ExplicitRouteError, explicitRouteSshOptions, type ExplicitRoute } from "./explicit-route"; +import { REMOTE_SERVED_PATH_TRUST } from "./remote-runtime-trust"; import { POWERSHELL_ENCODED_MAX, PowerShellCommandTooLongError, ROUTE_OVERWRITE_MIN_CHILD_VERSION, windowsGatedOcxArgv, windowsOcxArgv, windowsOverwriteSyncArgv } from "./remote-windows"; export type TunnelDirection = "R" | "L"; @@ -207,7 +208,7 @@ export const REMOTE_PLATFORM_UNSUPPORTED = 125; * unreadable file or a missing awk fails without writing to stderr. * Shared by the ocx discovery, pinned sync and runtime inspection scripts. */ -export const REMOTE_SERVED_RUNTIME = `served_runtime() { +export const REMOTE_SERVED_RUNTIME = `${REMOTE_SERVED_PATH_TRUST}served_runtime() { # The count below reports wc's status, never dd's: a missing dd or an unreadable file ends here, # and a dd that fails anyway counts zero bytes, which is refused like an oversized census. [ -f "$1" ] && [ -r "$1" ] && command -v dd >/dev/null 2>&1 || return 1 @@ -237,7 +238,7 @@ export const REMOTE_SERVED_RUNTIME = `served_runtime() { /** * Tries the served install with \`attempt\`, which must read \`$served_bin\` and honour \`$ocx_entry\`: - * a compiled binary runs alone, and a package pair runs as \`bun \` only while the entry exists. + * a compiled binary runs alone, and both package paths must pass the same trust gate. * The unquoted \`OCX_SERVED\` heredoc is safe only because \`served_runtime\` prints paths without * quotes, backslashes or newlines; relaxing that character class would let a path expand or split. */ @@ -247,9 +248,12 @@ if served=$(served_runtime "\${OPENCODEX_HOME:-$HOME/.opencodex}/serving-runtime { IFS= read -r served_bin; IFS= read -r served_entry; } <`: the global file is disabled with `GlobalKnownHostsFile=none`, and `KnownHostsCommand=none`, `VerifyHostKeyDNS=no` and `CheckHostIP=no` shut out every other source of host-key trust. Command-line options take precedence over `~/.ssh/config`, so a user config cannot re-enable them. `HashKnownHosts=no` preserves alias-prefixed records in these private files without changing the user's normal known_hosts file. Tunnel and exec commands use `StrictHostKeyChecking=yes`; only the probe uses `accept-new`, against an empty temporary file, so an offered key can be shown before it is trusted. The known_hosts path must be absolute and free of ssh expansion syntax. Forwards bind 127.0.0.1 on both ends, and aliases that could be parsed as options are refused. -Every remote `ocx` call goes through `remoteOcxArgv` with the link's platform. On POSIX it is a quoted `sh -c` script. After an ephemeral `ocx-child` (below), it first tries the install that last started serving this home (#8359): every `ocx start` that binds records its relaunch argv at the front of `$OPENCODEX_HOME/serving-runtimes.json` (`src/config/serving-runtimes.ts`), `[ocx]` for a compiled binary or `[bun, cli/index.ts]` for a package install, so a desktop takeover or a service restart moves its own install to the front, and a start that never binds records nothing. The served install wins whatever its version, because it is what the Child runs. The script reads only the first entry's `command`, one or two absolute paths without quotes or backslashes in a file of at most 64 KiB; it runs a pair as `bun ...` only while the entry file exists, and any other shape, a first record without a command, a file cut off before its closing brace, a missing or unreadable file or a failed `--version` falls through. The reader accepts only the complete document in the recorder's own two-space layout. The pinned sync script shares this block, so the served install's own version gates `sync --expect-link`. Runtime inspection (`POSIX_INSPECT_SCRIPT` in `src/link/remote-plant.ts`) reads the same census through `REMOTE_SERVED_RUNTIME`, so `ocx link probe` reports the served install's version and kind. On Windows, discovery (`windowsOcxArgv`) and runtime inspection (`windowsInspectRuntimeArgv`) read the same first record with `ConvertFrom-Json` (#8359): one or two rooted paths without quotes or control characters in a file of at most 64 KiB found where the writer's `getConfigDir()` puts it (a trimmed `OPENCODEX_HOME`, else `%USERPROFILE%\.opencodex`; a Child state there or in the legacy home keeps `ocx-child` first), the served install ahead of every fixed candidate except `ocx-child` under a Child state. A `[bun.exe, cli\index.ts]` npm pair runs as `bun.exe ...` only while the entry exists: the compiled helper's `V` and `Ok` take a CRT-quoted argument prefix for the `--version` probe, and the run passes the entry ahead of the command's arguments. The pinned and overwrite syncs and the gated update plan read the same census, so the served install also answers their version gate (#8359); `Ok` is `V` succeeding, so a candidate must also print at most 256 characters for `--version`. Then it tries executable Desktop and system candidates before generic PATH shims: `$HOME/.opencodex-desktop/bin/ocx`, `/Applications/OpenCodex.app/Contents/MacOS/ocx`, `/usr/bin/ocx`, then inherited PATH plus Bun/local/Homebrew directories. Each candidate must successfully report `--version`; an unrunnable stale shim is skipped. Arguments remain quoted once. The script still exits 125 on a Windows/MSYS/Cygwin `uname`, a guard against POSIX dispatch to a Windows host; exhaustion exits 127 (`remote_ocx_missing`). On Windows, `src/link/remote-windows.ts` builds one `powershell.exe -NoLogo -NoProfile -NonInteractive -EncodedCommand` command whose arguments travel as base64 JSON data, never as shell text, and `quoteRemote` admits only that exact shape. After the served install above, the script tries the Desktop `ocx.exe`, the GOAT-managed `.local/share/goat/opencodex/current/ocx.exe` junction under the user profile, `.local/bin/ocx.exe`, the per-user and Program Files OpenCodex directories, then PATH. Each candidate must answer `--version` within ten seconds, and only the selected one runs the real command with CRT-quoted arguments and inherited standard handles, so the link key still arrives on stdin and the exit status passes through. The whole script travels deflated so the command fits, packed 14 bits per character in U+3400..U+73FF (no ASCII, no smart quotes, no surrogates) with its byte count, and the Child inflates it before anything in it runs; `windowsInflatedScript` is the one test-side decoder. A helper compiled with `Add-Type` (`OCX_JOB_SOURCE`, a quoted literal inside that script, never evaluated as PowerShell) creates that process with `PROC_THREAD_ATTRIBUTE_JOB_LIST`, so it is a member of a Win32 Job with kill-on-close and silent breakaway from the moment it exists: terminating the PowerShell host, which is what the SSH server does with a dropped channel, kills that `ocx.exe`, while a runtime it starts on its own breaks away and survives. One finally block releases the attribute list and the process, thread and Job handles on every path and terminates the child through its own handle if anything fails after creation. If the inflation or `Add-Type` fails (Constrained Language Mode blocks both the stream types and `Add-Type`, for example), the command exits 126 before any `ocx.exe` is probed or started. A failure while the helper creates, waits on or reads the selected process also exits 126, after the finally block above has terminated that process. There is no uncontained fallback. The `--version` probes that choose a candidate run outside the Job, bounded to ten seconds each; only the selected command runs inside it. The inflation guard covers the inflation alone, so the exit status and errors of the inflated script itself pass through unchanged. The encoded command stays under 8,000 characters for cmd.exe's 8,191-character command line. A dropped real OpenSSH channel is a required native release gate: the opt-in case in `tests/clients/link-ssh-argv-discovery.test.ts` runs against a disposable Windows OpenSSH host named by `OCX_WINDOWS_OPENSSH_FIXTURE`. Exhaustion exits 127. Coverage: `tests/clients/link-ssh-argv-discovery.test.ts`. +Every remote `ocx` call goes through `remoteOcxArgv` with the link's platform. On POSIX it is a quoted `sh -c` script. After an ephemeral `ocx-child` (below), it first tries the install that last started serving this home (#8359): every `ocx start` that binds records its relaunch argv at the front of `$OPENCODEX_HOME/serving-runtimes.json` (`src/config/serving-runtimes.ts`), `[ocx]` for a compiled binary or `[bun, cli/index.ts]` for a package install, so a desktop takeover or a service restart moves its own install to the front, and a start that never binds records nothing. The served install wins whatever its version, because it is what the Child runs. The script reads only the first entry's `command`, one or two absolute paths without quotes or backslashes in a file of at most 64 KiB; before any version probe, `src/link/remote-runtime-trust.ts` checks the executable and optional entrypoint as regular files owned by the SSH account without group/world write bits. It resolves at most 40 symlinks and checks at most 512 components, including replacement authority along original and resolved paths: directories and symlinks belong to root or the SSH account, and a writable directory requires its sticky bit plus trusted ownership of its next entry. The ownership/mode gate admits Linux only. On macOS, ACL grants can override mode bits and system `ls -lde` can silently report an unreadable ACL as absent, so recorded census targets are skipped before any probe; existing Desktop/system/PATH discovery continues. Re-enabling macOS census priority requires a native ACL reader that distinguishes absent ACLs from failed reads along the entire path. Unknown or unreadable platforms also skip recorded targets. The checked Linux paths retain their original spelling for package-prefix and entrypoint compatibility. Missing identity/stat/readlink evidence skips the recorded candidate; these ownership/mode checks do not resist root or unrestricted same-account changes. It runs a trusted pair as `bun ...`, and any other shape, a first record without a command, a file cut off before its closing brace, a missing, unreadable or untrusted target, or a failed `--version` falls through. `tests/clients/link-served-runtime-trust.test.ts` covers discovery, pinned sync, inspection and full-install census before either path executes. The reader accepts only the complete document in the recorder's own two-space layout. The pinned sync script shares this block, so the served install's own version gates `sync --expect-link`. Runtime inspection (`POSIX_INSPECT_SCRIPT` in `src/link/remote-plant.ts`) reads the same census through `REMOTE_SERVED_RUNTIME`, so `ocx link probe` reports the served install's version and kind. On Windows, discovery (`windowsOcxArgv`) and runtime inspection (`windowsInspectRuntimeArgv`) read the same first record with `ConvertFrom-Json` (#8359): one or two rooted paths without quotes or control characters in a file of at most 64 KiB found where the writer's `getConfigDir()` puts it (a trimmed `OPENCODEX_HOME`, else `%USERPROFILE%\.opencodex`; a Child state there or in the legacy home keeps `ocx-child` first), the served install ahead of every fixed candidate except `ocx-child` under a Child state. A `[bun.exe, cli\index.ts]` npm pair runs as `bun.exe ...` only while the entry exists: the compiled helper's `V` and `Ok` take a CRT-quoted argument prefix for the `--version` probe, and the run passes the entry ahead of the command's arguments. The pinned and overwrite syncs and the gated update plan read the same census, so the served install also answers their version gate (#8359); `Ok` is `V` succeeding, so a candidate must also print at most 256 characters for `--version`. Then it tries executable Desktop and system candidates before generic PATH shims: `$HOME/.opencodex-desktop/bin/ocx`, `/Applications/OpenCodex.app/Contents/MacOS/ocx`, `/usr/bin/ocx`, then inherited PATH plus Bun/local/Homebrew directories. Each candidate must successfully report `--version`; an unrunnable stale shim is skipped. Arguments remain quoted once. The script still exits 125 on a Windows/MSYS/Cygwin `uname`, a guard against POSIX dispatch to a Windows host; exhaustion exits 127 (`remote_ocx_missing`). On Windows, `src/link/remote-windows.ts` builds one `powershell.exe -NoLogo -NoProfile -NonInteractive -EncodedCommand` command whose arguments travel as base64 JSON data, never as shell text, and `quoteRemote` admits only that exact shape. After the served install above, the script tries the Desktop `ocx.exe`, the GOAT-managed `.local/share/goat/opencodex/current/ocx.exe` junction under the user profile, `.local/bin/ocx.exe`, the per-user and Program Files OpenCodex directories, then PATH. Each candidate must answer `--version` within ten seconds, and only the selected one runs the real command with CRT-quoted arguments and inherited standard handles, so the link key still arrives on stdin and the exit status passes through. The whole script travels deflated so the command fits, packed 14 bits per character in U+3400..U+73FF (no ASCII, no smart quotes, no surrogates) with its byte count, and the Child inflates it before anything in it runs; `windowsInflatedScript` is the one test-side decoder. A helper compiled with `Add-Type` (`OCX_JOB_SOURCE`, a quoted literal inside that script, never evaluated as PowerShell) creates that process with `PROC_THREAD_ATTRIBUTE_JOB_LIST`, so it is a member of a Win32 Job with kill-on-close and silent breakaway from the moment it exists: terminating the PowerShell host, which is what the SSH server does with a dropped channel, kills that `ocx.exe`, while a runtime it starts on its own breaks away and survives. One finally block releases the attribute list and the process, thread and Job handles on every path and terminates the child through its own handle if anything fails after creation. If the inflation or `Add-Type` fails (Constrained Language Mode blocks both the stream types and `Add-Type`, for example), the command exits 126 before any `ocx.exe` is probed or started. A failure while the helper creates, waits on or reads the selected process also exits 126, after the finally block above has terminated that process. There is no uncontained fallback. The `--version` probes that choose a candidate run outside the Job, bounded to ten seconds each; only the selected command runs inside it. The inflation guard covers the inflation alone, so the exit status and errors of the inflated script itself pass through unchanged. The encoded command stays under 8,000 characters for cmd.exe's 8,191-character command line. A dropped real OpenSSH channel is a required native release gate: the opt-in case in `tests/clients/link-ssh-argv-discovery.test.ts` runs against a disposable Windows OpenSSH host named by `OCX_WINDOWS_OPENSSH_FIXTURE`. Exhaustion exits 127. Coverage: `tests/clients/link-ssh-argv-discovery.test.ts`. `src/link/remote-platform.ts` discovers the platform through the pinned host key: `requireRemotePlatform` runs the fixed, locale-independent `cmd /c echo %OS%` (`WINDOWS_OS_PROBE`), treats `Windows_NT` as Windows, and otherwise classifies `uname -s`. An ssh transport failure or an unclassifiable answer throws, so enrollment answers `probe_failed` before it trusts the host or issues a key. The first-contact probe runs the cross-shell `echo ocx-link-probe` and requires that exact output. The probe stores the platform on the pending host, confirmation and apply reuse it, and the link record keeps it as the optional `remotePlatform` in `src/link/store.ts`; a record written before the field existed is discovered again under its pinned key. The optional `childKind` (`"ephemeral" | "full"`) joined the same strict `RECORD_KEYS` set with the ocx-child plant flow, with the same trade-off as `remotePlatform`: a Home downgraded to a release without the field rejects a `links.json` that contains it, so downgrading needs those links disconnected (or the field removed) first. On Windows, enrollment skips the curl preflight and reads the Child's loopback `/healthz` and `/v1/catalog` with a bounded .NET request that ignores proxies, never follows a redirect and caps the body at 4 MiB (`windowsChildHttpArgv`). Ordinary revoke, the Child-initiated issue and revoke in `src/client/link-join.ts` and `src/client/link-teardown.ts`, and the read-only `ocx link cleanup` in `src/cli/link-cleanup.ts` use the same adapter. Coverage: `tests/server/link-enrollment.test.ts`, `tests/server/link-management-routes.test.ts`, `tests/cli/cli-link-cleanup.test.ts`, `tests/clients/link-store.test.ts`. diff --git a/tests/clients/link-child-update-launcher.test.ts b/tests/clients/link-child-update-launcher.test.ts index a04ecf8da64..b79ecf07bf9 100644 --- a/tests/clients/link-child-update-launcher.test.ts +++ b/tests/clients/link-child-update-launcher.test.ts @@ -34,11 +34,13 @@ function stubNode(path: string): void { function install(root: string, options: { version?: string; launcherFile?: boolean } = {}) { const home = mkdtempSync(join(tmpdir(), "ocx-launcher-")); dirs.push(home); const bin = join(home, "bin"); mkdirSync(bin); - for (const command of ["sh", "uname", "mktemp", "sleep", "cat", "awk", "dd", "wc", "rm", "date"]) { + for (const command of ["sh", "mktemp", "sleep", "cat", "awk", "dd", "wc", "rm", "date", "stat", "id", "readlink"]) { const executable = Bun.which(command); if (!executable) throw new Error("Required test tool not found on PATH: " + command); symlinkSync(executable, join(bin, command)); } + // Recorded runtime fixtures exercise Linux policy on either POSIX test host. + writeFileSync(join(bin, "uname"), "#!/bin/sh\nprintf 'Linux\\n'\n", { mode: 0o755 }); const pkg = join(home, root); const entry = join(pkg, "src", "cli", "index.ts"); mkdirSync(join(pkg, "src", "cli"), { recursive: true }); diff --git a/tests/clients/link-gated-ocx-argv.test.ts b/tests/clients/link-gated-ocx-argv.test.ts index 2526ff005f8..08ab8557bfa 100644 --- a/tests/clients/link-gated-ocx-argv.test.ts +++ b/tests/clients/link-gated-ocx-argv.test.ts @@ -27,11 +27,13 @@ function isolated(argv: string[]): string[] { function fixture(prefix: string) { const home = mkdtempSync(join(tmpdir(), prefix)); dirs.push(home); const bin = join(home, "bin"); mkdirSync(bin); - for (const command of ["sh", "uname", "mktemp", "sleep", "cat", "awk", "dd", "wc", "rm", "date"]) { + for (const command of ["sh", "mktemp", "sleep", "cat", "awk", "dd", "wc", "rm", "date", "stat", "id", "readlink"]) { const executable = Bun.which(command); if (!executable) throw new Error("Required test tool not found on PATH: " + command); symlinkSync(executable, join(bin, command)); } + // Recorded runtime fixtures exercise Linux policy on either POSIX test host. + writeFileSync(join(bin, "uname"), "#!/bin/sh\nprintf 'Linux\\n'\n", { mode: 0o755 }); return { home, bin }; } /** A fake executable that logs its arguments and answers --version with the given text. */ diff --git a/tests/clients/link-pinned-sync-argv.test.ts b/tests/clients/link-pinned-sync-argv.test.ts index 75e2ccaaebe..33013a33886 100644 --- a/tests/clients/link-pinned-sync-argv.test.ts +++ b/tests/clients/link-pinned-sync-argv.test.ts @@ -15,11 +15,13 @@ function isolatedArgv(): string[] { } function toolDir(home: string): string { const bin = join(home, "bin"); mkdirSync(bin); - for (const command of ["sh", "uname", "mktemp", "sleep", "cat", "awk", "dd", "wc", "rm"]) { + for (const command of ["sh", "mktemp", "sleep", "cat", "awk", "dd", "wc", "rm", "stat", "id", "readlink"]) { const executable = Bun.which(command); if (!executable) throw new Error(`Required test tool not found on PATH: ${command}`); symlinkSync(executable, join(bin, command)); } + // Recorded runtime fixtures exercise Linux policy on either POSIX test host. + writeFileSync(join(bin, "uname"), "#!/bin/sh\nprintf 'Linux\\n'\n", { mode: 0o755 }); return bin; } function run(version: string) { diff --git a/tests/clients/link-served-runtime-trust.test.ts b/tests/clients/link-served-runtime-trust.test.ts new file mode 100644 index 00000000000..598cd5ed17e --- /dev/null +++ b/tests/clients/link-served-runtime-trust.test.ts @@ -0,0 +1,196 @@ +import { afterEach, expect, test } from "bun:test"; +import { chmodSync, existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { dirname, join } from "node:path"; +import { remoteOcxArgv, remotePinnedSyncArgv } from "../../src/link/ssh-argv"; +import { remoteFullInstallCensusArgv, remoteInspectRuntimeArgv } from "../../src/link/remote-plant"; +import { REMOTE_SERVED_PATH_TRUST } from "../../src/link/remote-runtime-trust"; +import { spawnTestChild } from "../helpers/spawn-test-child"; +import { SPAWN_BUDGET_MS } from "../helpers/test-budget"; + +const posix = test.skipIf(process.platform === "win32"); +const roots: string[] = []; +const active = new Set(); +afterEach(() => { for (const root of roots.splice(0)) if (!active.has(root)) rmSync(root, { recursive: true, force: true }); }); +const q = (text: string) => `'${text.replaceAll("'", "'\\''")}'`; + +function executable(path: string, body: string): void { + mkdirSync(dirname(path), { recursive: true }); + writeFileSync(path, `#!/bin/sh\n${body}\n`, { mode: 0o755 }); +} + +function fixture(platform = "Linux") { + const home = mkdtempSync(join(tmpdir(), "ocx-runtime-trust-")); roots.push(home); + const bin = join(home, "tools"); mkdirSync(bin); + for (const name of ["sh", "mktemp", "sleep", "cat", "awk", "dd", "wc", "rm", "stat", "id", "readlink"]) { + const command = Bun.which(name); + if (!command) throw new Error(`Missing fixture tool: ${name}`); + symlinkSync(command, join(bin, name)); + } + // Exercise the Linux gate on either POSIX host; Darwin fallback has separate cases. + executable(join(bin, "uname"), `printf '%s\\n' ${q(platform)}`); + const served = join(home, "package/bun"); + const entry = join(home, "package/src/cli/index.ts"); + mkdirSync(dirname(entry), { recursive: true }); writeFileSync(entry, "// fixture entry\n"); + executable(served, `printf '%s\\n' "$*" >> "$HOME/served-calls" +for arg do if [ "$arg" = --version ]; then printf 'opencodex 2.99.0\\n'; exit 0; fi; done +printf 'served\\n'`); + executable(join(home, ".opencodex-desktop/bin/ocx"), `if [ "$1" = --version ]; then printf 'opencodex 2.98.0\\n'; exit 0; fi +printf 'fallback\\n'`); + const config = join(home, ".opencodex"); mkdirSync(config); + const record = (command: string[]) => writeFileSync(join(config, "serving-runtimes.json"), JSON.stringify({ runtimes: [{ command }] }, null, 2) + "\n"); + record([served, entry]); + const run = async (argv: string[]) => { + const isolated = [...argv]; + isolated[2] = isolated[2]! + .replace('export PATH="$PATH:$HOME/.bun/bin:$HOME/.local/bin:/opt/homebrew/bin:/usr/local/bin"', 'export PATH="$PATH"') + .replaceAll('"/Applications/OpenCodex.app/Contents/MacOS/ocx"', '"$HOME/missing-app"') + .replaceAll('"/usr/bin/ocx"', '"$HOME/missing-system"'); + active.add(home); + const result = await spawnTestChild(isolated, { cwd: home, deadlineMs: 10_000, env: { HOME: home, OPENCODEX_HOME: config, PATH: bin, TMPDIR: home } }); + if (result.reaped && result.pipesClosed) active.delete(home); + expect(result.timedOut).toBe(false); expect(result.reaped).toBe(true); expect(result.pipesClosed).toBe(true); + expect(result.exitCode).toBe(0); + return result; + }; + return { home, bin, served, entry, record, run }; +} + +const consumers = [ + ["discovery", () => remoteOcxArgv(["link", "port"])], + ["pinned sync", () => remotePinnedSyncArgv("lnk_0123456789abcdef")], + ["inspection", () => remoteInspectRuntimeArgv()], + ["full-install census", () => remoteFullInstallCensusArgv()], +] as const; + +for (const [name, argv] of consumers) { + posix(`${name} refuses a writable recorded binary before its version probe`, async () => { + const f = fixture(); chmodSync(f.served, 0o777); + const result = await f.run(argv()); + expect(existsSync(join(f.home, "served-calls"))).toBe(false); + expect(result.stderr).not.toContain("not found"); + }, SPAWN_BUDGET_MS); + posix(`${name} refuses a writable recorded entrypoint before starting its interpreter`, async () => { + const f = fixture(); chmodSync(f.entry, 0o666); + await f.run(argv()); + expect(existsSync(join(f.home, "served-calls"))).toBe(false); + }, SPAWN_BUDGET_MS); +} + +posix.each(["binary", "entry"] as const)("a foreign-owned recorded %s is not executed", async target => { + const f = fixture(); + const foreign = process.getuid?.() === 0 ? 65534 : 0; + const path = target === "binary" ? f.served : f.entry; + const realStat = Bun.which("stat")!; + unlinkSync(join(f.bin, "stat")); + executable(join(f.bin, "stat"), `for last do :; done +if [ "$last" = ${q(path)} ]; then printf '${foreign} 755\\n'; else exec ${q(realStat)} "$@"; fi`); + await f.run(remoteOcxArgv(["link", "port"])); + expect(existsSync(join(f.home, "served-calls"))).toBe(false); +}, SPAWN_BUDGET_MS); + +posix.each(["binary", "entry"] as const)("a replaceable ancestor of the recorded %s is refused", async target => { + const f = fixture(); + // The entry's immediate parent differs from the interpreter's parent. + chmodSync(target === "binary" ? dirname(f.served) : dirname(f.entry), 0o777); + await f.run(remoteOcxArgv(["link", "port"])); + expect(existsSync(join(f.home, "served-calls"))).toBe(false); +}, SPAWN_BUDGET_MS); + +posix("trusted sticky ancestors and owned symlinked package paths remain usable", async () => { + const f = fixture(); + chmodSync(dirname(f.served), 0o1777); + const linked = join(f.home, "current-package"); symlinkSync("package", linked); + f.record([join(linked, "bun"), join(linked, "src/cli/index.ts")]); + const result = await f.run(remoteOcxArgv(["link", "port"])); + expect(result.stdout).toBe("served\n"); + expect(readFileSync(join(f.home, "served-calls"), "utf8")).toContain(join(linked, "src/cli/index.ts")); +}, SPAWN_BUDGET_MS); + +posix("symlink destinations cannot conceal a replaceable ancestor", async () => { + const f = fixture(); + const linked = join(f.home, "current-package"); symlinkSync("package", linked); + f.record([join(linked, "bun"), join(linked, "src/cli/index.ts")]); + chmodSync(dirname(f.served), 0o777); + await f.run(remoteOcxArgv(["link", "port"])); + expect(existsSync(join(f.home, "served-calls"))).toBe(false); +}, SPAWN_BUDGET_MS); + +posix("a symlink loop is skipped within the bounded resolver", async () => { + const f = fixture(); + symlinkSync("loop", join(f.home, "loop")); f.record([join(f.home, "loop")]); + expect((await f.run(remoteOcxArgv(["link", "port"]))).stdout).toBe("fallback\n"); + expect(existsSync(join(f.home, "served-calls"))).toBe(false); +}, SPAWN_BUDGET_MS); + +posix("a trailing newline in a symlink target cannot substitute the checked path", async () => { + const f = fixture(); + const newlineTarget = f.served + "\n"; + executable(newlineTarget, 'printf "unexpected\\n" >> "$HOME/served-calls"; printf "opencodex 2.99.0\\n"'); + chmodSync(newlineTarget, 0o777); + symlinkSync("package/bun\n", join(f.home, "linked-bun")); + f.record([join(f.home, "linked-bun")]); + const result = await f.run(remoteOcxArgv(["link", "port"])); + expect(result.stdout).toBe("fallback\n"); + expect(existsSync(join(f.home, "served-calls"))).toBe(false); +}, SPAWN_BUDGET_MS); + +posix.each(["stat", "id"])("missing %s skips the recorded install without running it", async tool => { + const f = fixture(); unlinkSync(join(f.bin, tool)); + const result = await f.run(remoteOcxArgv(["link", "port"])); + expect(result.stdout).toBe("fallback\n"); expect(result.stderr).toBe(""); + expect(existsSync(join(f.home, "served-calls"))).toBe(false); +}, SPAWN_BUDGET_MS); + +posix("a missing symlink reader never treats the link as a regular executable", async () => { + const f = fixture(); unlinkSync(join(f.bin, "readlink")); + symlinkSync("package/bun", join(f.home, "linked-bun")); + f.record([join(f.home, "linked-bun"), f.entry]); + const result = await f.run(remoteOcxArgv(["link", "port"])); + expect(result.stdout).toBe("fallback\n"); expect(result.stderr).toBe(""); + expect(existsSync(join(f.home, "served-calls"))).toBe(false); +}, SPAWN_BUDGET_MS); + +posix("BSD stat preserves sticky ancestors and zero-padded permission bits", async () => { + const f = fixture(); const realStat = Bun.which("stat")!; + chmodSync(dirname(f.served), 0o1777); + unlinkSync(join(f.bin, "stat")); + executable(join(f.bin, "stat"), `if [ "$1" = -c ]; then exit 1; fi +[ "$1" = -f ] || exit 1 +format=$2 +shift 2 +${process.platform === "darwin" ? `exec ${q(realStat)} -f "$format" "$@"` : `info=$(${q(realStat)} -c '%u %a' "$@") || exit 1 +set -- $info +mode=$((0$2)) +case "$format" in + '%u %Lp') printf '%s %o\\n' "$1" "$((mode & 0777))";; + '%u %Mp%Lp') printf '%s %o%o\\n' "$1" "$((mode >> 9 & 7))" "$((mode & 0777))";; + '%u %Mp%03Lp') printf '%s %o%03o\\n' "$1" "$((mode >> 9 & 7))" "$((mode & 0777))";; + *) exit 1;; +esac`}`); + expect((await f.run(remoteOcxArgv(["link", "port"]))).stdout).toBe("served\n"); + for (const mode of [0o1007, 0o4005]) { + chmodSync(f.entry, mode); + const result = await f.run(["sh", "-c", `${REMOTE_SERVED_PATH_TRUST}\nserved_path_info ${q(f.entry)}`]); + expect(result.stdout).toBe(`${process.getuid!()} ${mode.toString(8)}\n`); + } +}, SPAWN_BUDGET_MS); + +for (const [name, argv] of consumers) { + posix.each(["binary", "package"] as const)(`Darwin ${name} skips recorded %s hints before any version probe`, async kind => { + const f = fixture("Darwin"); + if (kind === "binary") f.record([f.served]); + const result = await f.run(argv()); + expect(existsSync(join(f.home, "served-calls"))).toBe(false); + if (name === "discovery") expect(result.stdout).toBe("fallback\n"); + if (name === "pinned sync") expect(result.stderr).toContain("ocx-fanout:selected:2.98.0"); + if (name === "inspection") expect(result.stdout).toContain("ocx-inspect:version:opencodex 2.98.0"); + if (name === "full-install census") expect(result.stdout).toContain("ocx-census:full"); + }, SPAWN_BUDGET_MS); +} + +posix.each(["FreeBSD", ""])("an unverified platform %s skips recorded hints", async platform => { + const f = fixture(platform); + expect((await f.run(remoteOcxArgv(["link", "port"]))).stdout).toBe("fallback\n"); + expect(existsSync(join(f.home, "served-calls"))).toBe(false); +}, SPAWN_BUDGET_MS); diff --git a/tests/clients/link-ssh-argv-discovery.test.ts b/tests/clients/link-ssh-argv-discovery.test.ts index 4e1722c0f02..aed44095081 100644 --- a/tests/clients/link-ssh-argv-discovery.test.ts +++ b/tests/clients/link-ssh-argv-discovery.test.ts @@ -114,8 +114,9 @@ test.skipIf(process.platform === "win32").each(["Windows_NT", "MSYS_NT-10.0-2263 * The census is written by the real recorder, so a format change on that side breaks these cases. */ function servedFixture(tools = ["awk", "dd", "wc"]) { - const f = fixture(); - for (const tool of tools) symlinkSync(Bun.which(tool)!, join(f.home, "remote-bin", tool)); + const f = fixture("Linux"); // Recorded hints require the Linux ownership/mode gate. + // Keep trust evidence available when a case removes one of the census reader's tools. + for (const tool of new Set([...tools, "stat", "id", "readlink"])) symlinkSync(Bun.which(tool)!, join(f.home, "remote-bin", tool)); f.install(0); // a runnable Desktop copy that must lose to the served install const census = (command: string[]) => recordServingRuntime( { command, version: "2.99.0", servedAt: "2026-11-09T00:00:00.000Z" }, @@ -504,7 +505,8 @@ test.skipIf(process.platform === "win32")("runtime inspection reports the served writeFileSync(cli, "// entry\n"); recordServingRuntime({ command: [bun, cli], version: "2.99.0", servedAt: "2026-11-09T00:00:00.000Z" }, join(home, ".opencodex")); const bin = join(home, "tools"); mkdirSync(bin); - for (const tool of ["sh", "uname", "awk", "dd", "wc"]) symlinkSync(Bun.which(tool)!, join(bin, tool)); + for (const tool of ["sh", "awk", "dd", "wc", "stat", "id", "readlink"]) symlinkSync(Bun.which(tool)!, join(bin, tool)); + executable(join(bin, "uname"), "printf 'Linux\\n'"); const result = Bun.spawnSync(remoteInspectRuntimeArgv("posix"), { env: { HOME: home, PATH: bin }, stdout: "pipe", stderr: "pipe" }); const lines = result.stdout.toString().split("\n"); expect(result.exitCode).toBe(0); diff --git a/tests/fixtures/test-layout-expected.json b/tests/fixtures/test-layout-expected.json index 289167d3f2b..fbe672f1c9d 100644 --- a/tests/fixtures/test-layout-expected.json +++ b/tests/fixtures/test-layout-expected.json @@ -1,4 +1,4 @@ -{ "responses-combo-unavailable-cause.test.ts": "responses", "responses-native-sse-stall.test.ts": "responses", "client-restart-sync-fence.test.ts": "clients", "service-scheduler-restart-respawn-refusal.test.ts": "service", "route-to-home-sync-review.test.ts": "routing", "route-intent-connect-post-commit.test.ts": "clients", "route-intent-file-originals.test.ts": "clients", "route-to-child-defaults.test.ts": "routing", "route-to-home-live-flags.test.ts": "routing", "route-to-home-native-truth.test.ts": "routing", "route-to-home-decisions.test.ts": "routing", "route-to-ephemeral.test.ts": "server", "link-pinned-sync-overwrite.test.ts": "clients", "cli-sync-fanout-ephemeral.test.ts": "cli", "route-intent-home-consent.test.ts": "clients", "management-route-intent-native-errors.test.ts": "server", "route-intent-offline-mode-switch.test.ts": "clients", "route-intent-parity-withdrawal.test.ts": "clients", "service-scheduler-restart-cleanup.test.ts": "service", "route-to-retirement-review.test.ts": "server", "route-to-policy-review.test.ts": "server", "management-route-intent-native-review.test.ts": "server", "route-to-home-off-review.test.ts": "routing", "codex-journal-provider-reserialization.test.ts": "codex-integration", "route-intent-parity-fallback.test.ts": "clients", "route-intent-native-originals.test.ts": "clients", "route-intent-native-review.test.ts": "clients", "route-intent-connected-capabilities.test.ts": "clients", "route-intent-connected-review.test.ts": "clients", "route-intent-connect-recovery.test.ts": "clients", "client-disconnect-field-snapshot.test.ts": "clients", "cli-route-to-confirmation.test.ts": "cli", "route-intent-runtime-stop.test.ts": "clients", "route-intent-codex-connect-disabled.test.ts": "clients", "route-intent-codex-transitions.test.ts": "clients", "route-to-live-settings.test.ts": "server", "route-intent-claude-surface.test.ts": "clients", "route-intent-local-receipt.test.ts": "clients", "route-intent-scheduler.test.ts": "clients", "route-intent-watch-client.test.ts": "clients", "route-intent-watch-boundary.test.ts": "server", "route-intent-watch-waiters.test.ts": "server", "home-route-intent-upgrade.test.ts": "clients", "route-intent-overwrite.test.ts": "clients", "codex-disconnect-owned-recovery.test.ts": "codex-integration", "service-restart-registration-guard.test.ts": "service", "client-disconnect-config-recovery.test.ts": "clients", "route-intent-aside.test.ts": "clients", "route-intent-connected.test.ts": "clients", "cli-link-route-intent.test.ts": "cli", "cli-route-to-aliases.test.ts": "cli", "cli-route-to.test.ts": "cli", "client-disconnect-edited-codex.test.ts": "clients", "codex-disconnect-fields.test.ts": "codex-integration", "link-home-route-intent.test.ts": "clients", "link-route-intent.test.ts": "server", "route-intent-desktop.test.ts": "clients", "route-intent-materializer.test.ts": "clients", "route-intent-parity.test.ts": "clients", "route-intent-reporter.test.ts": "clients", "route-intent-state.test.ts": "clients", "route-intent.test.ts": "clients", "route-to-routes.test.ts": "server", "route-to-sync-child.test.ts": "routing", "service-disconnected-client-restart.test.ts": "service", "responses-forward-client-headers-live.test.ts": "responses", "pool-retry-client-metadata.test.ts": "responses", "responses-websocket-workflow-ceiling.test.ts": "responses", "responses-workflow-send-ceiling.test.ts": "responses", "kimi-monthly-quota.test.ts": "providers", "sync-fanout.test.ts": "cli", "sync-command-fanout.test.ts": "cli", "link-pinned-sync-argv.test.ts": "clients", "sync-link-status.test.ts": "cli", "sync-fanout-process.test.ts": "cli", "codex-installation-acl.test.ts": "codex-integration", "codex-installation-id.test.ts": "codex-integration", "codex-installation-wire.test.ts": "codex-integration", "codex-installation-failover.test.ts": "responses", "lmstudio-system-policy.test.ts": "config", "openai-chat-single-system.test.ts": "adapters/openai", "update-reclaim-authorizer.test.ts": "update", "update-capability-policy.test.ts": "update", "update-service-home.test.ts": "update", "update-service-home-policy.test.ts": "update", "update-home-recovery.test.ts": "update", "update-recovery-authority.test.ts": "update", "update-recovery-boundaries.test.ts": "update", "update-home-launcher.test.ts": "update", "update-home-worker.test.ts": "update", "update-mutation-boundaries.test.ts": "update", "update-mutation-guard.test.ts": "update", "update-guarded-ops.test.ts": "update", "update-effect-authority.test.ts": "update", "update-windows-wrapper-authority.test.ts": "update", "update-mutation-scanner.test.ts": "update", "refreshed-upstream-deadlines.test.ts": "responses", "local-upstream-deadlines.test.ts": "responses", "service-desktop-recovery.test.ts": "service", "provider-input-modalities.test.ts": "providers", "turn-membership.test.ts": "responses", "turn-membership-ingress.test.ts": "responses", "workbuddy-quota.test.ts": "providers", "workbuddy-login.test.ts": "oauth", "workbuddy-adapter.test.ts": "adapters", "workbuddy-provider.test.ts": "providers", "link-tunnel-history.test.ts": "clients", "link-readiness.test.ts": "clients", "link-tunnel-status.test.ts": "clients", "link-diagnostics.test.ts": "clients", "combo-description.test.ts": "routing", "combo-description-catalog.test.ts": "codex-integration", "catalog-auto-review-override.test.ts": "codex-integration", "management-auto-review-settings.test.ts": "server", "management-auto-review-auth.test.ts": "server", "prefer-model-alias-ids.test.ts": "server", "responses-mimo-envelope.test.ts": "responses", "responses-call-id-linkage.test.ts": "responses", "responses-phase-inference.test.ts": "responses", "cli-message-mcp-resume.test.ts": "cli", "messaging-mcp-resume.test.ts": "codex-integration", "link-diagnostics-read.test.ts": "clients", "cli-link-diagnostics.test.ts": "cli", "link-diagnostics-route.test.ts": "server", "provider-passive-wire-model.test.ts": "providers", "passive-key-observation.test.ts": "providers", "responses-passive-key-limits.test.ts": "responses", "passive-key-limits.test.ts": "providers", "terminal-safe-text.test.ts": "lib", +{ "link-served-runtime-trust.test.ts": "clients", "responses-combo-unavailable-cause.test.ts": "responses", "responses-native-sse-stall.test.ts": "responses", "client-restart-sync-fence.test.ts": "clients", "service-scheduler-restart-respawn-refusal.test.ts": "service", "route-to-home-sync-review.test.ts": "routing", "route-intent-connect-post-commit.test.ts": "clients", "route-intent-file-originals.test.ts": "clients", "route-to-child-defaults.test.ts": "routing", "route-to-home-live-flags.test.ts": "routing", "route-to-home-native-truth.test.ts": "routing", "route-to-home-decisions.test.ts": "routing", "route-to-ephemeral.test.ts": "server", "link-pinned-sync-overwrite.test.ts": "clients", "cli-sync-fanout-ephemeral.test.ts": "cli", "route-intent-home-consent.test.ts": "clients", "management-route-intent-native-errors.test.ts": "server", "route-intent-offline-mode-switch.test.ts": "clients", "route-intent-parity-withdrawal.test.ts": "clients", "service-scheduler-restart-cleanup.test.ts": "service", "route-to-retirement-review.test.ts": "server", "route-to-policy-review.test.ts": "server", "management-route-intent-native-review.test.ts": "server", "route-to-home-off-review.test.ts": "routing", "codex-journal-provider-reserialization.test.ts": "codex-integration", "route-intent-parity-fallback.test.ts": "clients", "route-intent-native-originals.test.ts": "clients", "route-intent-native-review.test.ts": "clients", "route-intent-connected-capabilities.test.ts": "clients", "route-intent-connected-review.test.ts": "clients", "route-intent-connect-recovery.test.ts": "clients", "client-disconnect-field-snapshot.test.ts": "clients", "cli-route-to-confirmation.test.ts": "cli", "route-intent-runtime-stop.test.ts": "clients", "route-intent-codex-connect-disabled.test.ts": "clients", "route-intent-codex-transitions.test.ts": "clients", "route-to-live-settings.test.ts": "server", "route-intent-claude-surface.test.ts": "clients", "route-intent-local-receipt.test.ts": "clients", "route-intent-scheduler.test.ts": "clients", "route-intent-watch-client.test.ts": "clients", "route-intent-watch-boundary.test.ts": "server", "route-intent-watch-waiters.test.ts": "server", "home-route-intent-upgrade.test.ts": "clients", "route-intent-overwrite.test.ts": "clients", "codex-disconnect-owned-recovery.test.ts": "codex-integration", "service-restart-registration-guard.test.ts": "service", "client-disconnect-config-recovery.test.ts": "clients", "route-intent-aside.test.ts": "clients", "route-intent-connected.test.ts": "clients", "cli-link-route-intent.test.ts": "cli", "cli-route-to-aliases.test.ts": "cli", "cli-route-to.test.ts": "cli", "client-disconnect-edited-codex.test.ts": "clients", "codex-disconnect-fields.test.ts": "codex-integration", "link-home-route-intent.test.ts": "clients", "link-route-intent.test.ts": "server", "route-intent-desktop.test.ts": "clients", "route-intent-materializer.test.ts": "clients", "route-intent-parity.test.ts": "clients", "route-intent-reporter.test.ts": "clients", "route-intent-state.test.ts": "clients", "route-intent.test.ts": "clients", "route-to-routes.test.ts": "server", "route-to-sync-child.test.ts": "routing", "service-disconnected-client-restart.test.ts": "service", "responses-forward-client-headers-live.test.ts": "responses", "pool-retry-client-metadata.test.ts": "responses", "responses-websocket-workflow-ceiling.test.ts": "responses", "responses-workflow-send-ceiling.test.ts": "responses", "kimi-monthly-quota.test.ts": "providers", "sync-fanout.test.ts": "cli", "sync-command-fanout.test.ts": "cli", "link-pinned-sync-argv.test.ts": "clients", "sync-link-status.test.ts": "cli", "sync-fanout-process.test.ts": "cli", "codex-installation-acl.test.ts": "codex-integration", "codex-installation-id.test.ts": "codex-integration", "codex-installation-wire.test.ts": "codex-integration", "codex-installation-failover.test.ts": "responses", "lmstudio-system-policy.test.ts": "config", "openai-chat-single-system.test.ts": "adapters/openai", "update-reclaim-authorizer.test.ts": "update", "update-capability-policy.test.ts": "update", "update-service-home.test.ts": "update", "update-service-home-policy.test.ts": "update", "update-home-recovery.test.ts": "update", "update-recovery-authority.test.ts": "update", "update-recovery-boundaries.test.ts": "update", "update-home-launcher.test.ts": "update", "update-home-worker.test.ts": "update", "update-mutation-boundaries.test.ts": "update", "update-mutation-guard.test.ts": "update", "update-guarded-ops.test.ts": "update", "update-effect-authority.test.ts": "update", "update-windows-wrapper-authority.test.ts": "update", "update-mutation-scanner.test.ts": "update", "refreshed-upstream-deadlines.test.ts": "responses", "local-upstream-deadlines.test.ts": "responses", "service-desktop-recovery.test.ts": "service", "provider-input-modalities.test.ts": "providers", "turn-membership.test.ts": "responses", "turn-membership-ingress.test.ts": "responses", "workbuddy-quota.test.ts": "providers", "workbuddy-login.test.ts": "oauth", "workbuddy-adapter.test.ts": "adapters", "workbuddy-provider.test.ts": "providers", "link-tunnel-history.test.ts": "clients", "link-readiness.test.ts": "clients", "link-tunnel-status.test.ts": "clients", "link-diagnostics.test.ts": "clients", "combo-description.test.ts": "routing", "combo-description-catalog.test.ts": "codex-integration", "catalog-auto-review-override.test.ts": "codex-integration", "management-auto-review-settings.test.ts": "server", "management-auto-review-auth.test.ts": "server", "prefer-model-alias-ids.test.ts": "server", "responses-mimo-envelope.test.ts": "responses", "responses-call-id-linkage.test.ts": "responses", "responses-phase-inference.test.ts": "responses", "cli-message-mcp-resume.test.ts": "cli", "messaging-mcp-resume.test.ts": "codex-integration", "link-diagnostics-read.test.ts": "clients", "cli-link-diagnostics.test.ts": "cli", "link-diagnostics-route.test.ts": "server", "provider-passive-wire-model.test.ts": "providers", "passive-key-observation.test.ts": "providers", "responses-passive-key-limits.test.ts": "responses", "passive-key-limits.test.ts": "providers", "terminal-safe-text.test.ts": "lib", "responses-estimated-usage.test.ts": "responses", "codex-installation-live-content.test.ts": "codex-integration", "codex-installation-invalid-account.test.ts": "codex-integration",