Repository navigation
Conversation
…tion options Accept repeated --host for list, send and doctor. One host keeps the flat result; several return an ordered array whose elements keep schemaVersion, ok, host and command. Each destination gets one preflight and at most one request, and a refused or unknown host never triggers a retry or failover. Validate every host, option and message before any ssh process starts and refuse duplicate destinations. Add an allowlisted --ssh-opt (-p, -l, -i, -o Port/User/IdentityFile/IdentitiesOnly, -4, -6) re-emitted after the fixed BatchMode/StrictHostKeyChecking options; ProxyJump and every other option are refused. Accept bare and bracketed IPv6 literals and report sshUser/sshUserSource like Python. Closes #20
Add `session-peer update --check`, which reads the npm dist-tags for session-peer (latest by default, or preview) with one bounded request and reports current/latest/channel/source plus a package-manager-specific upgrade command derived from the resolved CLI path. `update` without --check never replaces npm-owned files and refuses with self_update_unsupported and guidance. Update is local only: --host and the SSH wire are refused. Cached client notices on list/send/doctor are opt-in via SESSION_PEER_UPDATE_NOTICE and honor --no-update-notice and SESSION_PEER_NO_UPDATE_NOTICE. The cache is private and atomic, refreshes run once in a detached single-flight child with a 3 s timeout, failures back off, and notices never change results, exit codes or wire responses. Refs #22
…ust boundaries Collect --host values before other validation so any pre-dispatch refusal with two or more hosts, including unknown options and missing values, is a per-host array; fewer hosts stay one flat object. Keep the user lookup inside per-host handling so a lookup failure leaves other results intact. Document that sshUser runs a bounded local ssh -G which evaluates the user's ssh configuration, separate the command-line allowlist from trusted user configuration, state that duplicate detection is syntactic, keep typed jump routing visible as open, and describe the lost-response fixture as an unknown classification case.
Emit an upgrade command only for a positively identified owner: an npm global prefix whose own launcher targets this package (default, Homebrew, nvm, nvm-windows, fnm), pnpm/Yarn/Bun global stores whose manifest declares session-peer, Volta or npx. Project installs, source checkouts and unknown layouts get no command and a guidance sentence instead. The refresh lock now holds a per-acquisition token inherited by the detached child. Release and stale takeover run under a short O_EXCL mutex and re-read the token, so a foreign generation is never deleted, and a takeover renames a new lock over the exact stale generation so only one taker can win. Document opt-out as suppressing background notices only, and that the local client adds its notice to results obtained over SSH while a --stdio-request receiver never produces one.
Background cache publication now runs under the takeover mutex and only while the worker's token is the current lock generation, and never replaces a cache record written after the refresh started. A refresh without a token does nothing. The mutex is itself token-owned; releasing it or reclaiming a stale one renames the file aside, keeps it only if it is the holder's token or the exact inode and mtime judged stale, and otherwise restores it with link(). Add `guidance` to the documented clientUpdate fields and report "no update needed" guidance for up_to_date/ahead results.
…oxyCommand Route every SSH call for every --host through one jump host given as USER@HOST[:PORT]. Instead of -J, whose hop receives no command-line BatchMode or StrictHostKeyChecking, build a fixed ProxyCommand: the shell-quoted and %-escaped ssh path with batch mode, strict host keys, no host-key updates, bounded connection attempts, no further proxy, control socket, agent or port forwarding, and no local command, then -W to the target. Validate the hop strictly, refuse it with --ssh-control-path and on Windows clients, report sshJump, and keep -J/ProxyJump/ProxyCommand refused in --ssh-opt.
With --ssh-jump, also fix ControlMaster=no, ControlPath=none and ProxyUseFdpass=no on the outer ssh before user options, so an existing master or fd-passing setting in ssh_config cannot skip or alter the hop. Verified with ssh -G against a fixture configuration.
…he writes Remove stale-lock takeover and the takeover mutex. A single O_EXCL lock with a random token now guards every cache write: the background refresh inherits the token from the invocation that created it, and an explicit `update --check` acquires the same lock around its write. Writers replace only records older than their own start. No code path moves or deletes a lock it did not create; an existing lock of any age skips the background refresh, and `update --check` reports why the cache was not written (new `cache` field). A crashed holder's lock must be removed by hand, as documented.
On POSIX, start every external command in its own process group. A timeout, an output overflow or SIGINT/SIGTERM/SIGHUP to the CLI kills that group, including a jump ProxyCommand that keeps the pipes open, and the call completes after the exit plus a short grace instead of waiting for the pipes. On Windows only the child is killed and the call returns at the deadline. Timeout classification is unchanged. Document the verified ProxyCommand shells and that --ssh-opt values are not passed to the jump hop. Closes #87
If writing the token fails right after the O_EXCL create, remove only that same inode before rethrowing. Report an unverifiable lock during an explicit check as `cache: "failed"` instead of the internal `not_owner`. Keep writeCache internal, narrow the PARITY guarantee to foreign locks, temporary files and resources, and document that manual lock removal can also follow I/O or release failures.
Register a detached child's group synchronously when spawn() returns a PID, keeping the spawn event as a fallback, so a signal that arrives before that event still reaps the group. Document that detached children run in a new session without a controlling terminal and that cleanup covers that group only.
…diagnostics Detect the sender from bounded evidence: the inherited inbox socket variable must match exactly one live registered session, and the Codex thread/session variable must be a valid UUID. Nested, conflicting or absent evidence gives no identity. Generate inert session-peer://v1/reply routes with host precedence --reply-to, SESSION_PEER_REPLY_HOST, CC_PEER_REPLY_HOST, then the tailnet address, and report replyRoute/addressResolution like the Python reference. Use tailscale status only as a routing hint with exact Online states: keep the SSH alias, add HostName for known online peers and HostKeyAlias only when ssh_config sets none, refuse known offline or ambiguous peers before SSH, and leave everything else as ordinary SSH. Normalize a reply URI to local only for this user on this machine. Add doctor --check-return-route as an explicit, bounded, noninteractive reverse SSH probe that stays bound to the origin and is never inferred from forward reachability. Closes #21
…eiver names from the login user Treat every numeric IPv4 form accepted by inet_aton (127.1, 2130706433, 0x7f.1, 0177.0.0.1, 0) and IPv4-mapped or compatible IPv6 as loopback or unspecified, without DNS. Decide whether a host names the receiver with a helper that ignores the login user, so an unusable local username cannot turn the receiver's own host name into a verified remote route.
A jump host implies SSH, so a reply URI naming this user on this machine is normalized to a local route only when neither --host, an SSH option nor --ssh-jump was given.
Split the host predicates. Return and reply hosts that might name a machine are refused without guessing resolver behavior: localhost names, canonical loopback and unspecified addresses, their mapped forms, IPv4-compatible IPv6 and every non-canonical numeric form. Local normalization accepts only exact localhost, canonical 127.x.y.z, ::1 and canonical mapped loopback, never a non-canonical numeric or an IPv4-compatible address.
State that the receiver refuses a known self name or an unprovable numeric form, that known names are only the exact OS host name and Tailscale self names and addresses, and that remote sends refuse loopback and non-canonical numeric reply hosts. Add regressions for a private return host and for an unusable login name.
Conflict resolutions keep each change's semantics: - src/cli.ts: #84/#86 parsing, repeated --host and reply routing are kept; `update`, `--check` and `--channel` are added. `update` refuses --host and --ssh-opt and is refused over the wire. The notice hook runs once per invocation and adds `clientUpdate` only to a flat result; a repeated --host JSON array keeps its exact shape, and text output gets one stderr line. The failure envelope still spreads update guidance. - src/help.ts, src/output.ts: both help texts and both render branches. - package.json, scripts/release.mjs, test/package-smoke.ts: union of test lists and packaged files (replies, ssh, updates). - PARITY.md and guides: both sections; the update notice scope documents the multi-host array contract.
Drop any clientUpdate supplied by a remote receiver before a verified SSH response is shown. Document that a flat per-host result, including a failed or unknown one, may carry the advisory while top-level parse and local caught failures never do, and that the advisory never changes status, exit code or retry decisions. Add POSIX regressions for the failure policy and a forged remote field, and a Windows fake-SSH case for the notice with a repeated --host array.
…ghten the Windows notice case
11 of 12 tasks
Owner
Author
|
Closing without merging: this review-only integration candidate (head |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refs #20 #21 #22
This branch combines:
It excludes #75, #79, and #83.
clientUpdateis client-local, the failure policy is pinned, and a Windows notice+array case is addedConflict resolutions
src/cli.ts:--host,--ssh-opt/--ssh-jump, and reply routing.update,--check,--channel.updaterefuses--host/--ssh-optand is refused over the wire (remote_update_unsupported).failure()envelope.src/help.ts,src/output.ts: both sides kept.package.json,scripts/release.mjs,test/package-smoke.ts: union of the test lists and the packaged files (replies, ssh, updates).PARITY.mdand the four guides: both sides' sections kept, plus integration contract text.test/fixtures/isolate-env.mjs: also clearsSESSION_PEER_UPDATE_NOTICE, so an opted-in developer environment cannot make tests reach the real registry.Integration contracts
--hostreturns a JSON array, the array keeps request order and every element keeps its exact shape. NoclientUpdateis added to elements, and no wrapper object is introduced.--host) gets the additiveclientUpdate. This also applies when that per-host result failed or is unknown.submitted,consumptionConfirmed, orretryAllowed.clientUpdateis client-local. AnyclientUpdatein a verified receiver response is dropped. A--stdio-requestreceiver never reads or refreshes the cache and never produces a notice.Type
Validation
npm ci --ignore-scriptsandnpm run buildSESSION_PEER_PYTHON_ROOT=/path/to/pinned/reference npm test: 121 tests, 116 pass, 0 fail, 5 skipped. All 5 skips are Windows-only tests that are skipped on macOS; one comes from feat(ssh): support ordered multi-host commands and constrained connection options #84 (ssh-hosts).npm run test:package: pass.npm audit: 0.node scripts/check-repository.mjs: OK. Release pack/artifact: validated.New tests in
test/integration-multihost-updates.test.ts(4 tests; POSIX fake ssh, local fixture registry, temp caches):clientUpdateis dropped: no key in array elements, no key with--no-update-notice, and the flat result shows only the locally computed value.Tested environments / limitations
test/windows-contract.test.tsadds one opted-in case through the encoded PowerShell fake SSH: a repeated--hostarray with no element field, one text stderr line, and a flat single-host field. The refresh count, the failure policy, and the forged-field cases are covered only on POSIX and are unverified on Windows.Release impact
None. This is a review-only candidate. It must not be merged, published, or used to retarget other PRs.