Skip to content

fix(ssh): validate bounded responses and preserve native outcomes - #127

Merged
abruption merged 2 commits into
mainfrom
fix/116-strict-ssh-response
Oct 9, 2026
Merged

abruption merged 2 commits into
mainfrom
fix/116-strict-ssh-response

Conversation

@abruption

@abruption abruption commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

Summary

Closes #116. Closes #115. Milestone: 0.3.3 — Ordinary SSH reliability and migration.

This is the ordinary SSH correction, independent of the Draft 0.4.0 handoff/app-server/observation work. No runtime version bump or publication is included.

  • Collect bounded raw protocol stdout before fatal UTF-8 decoding. Validate one complete JSON object, decoded duplicate keys at all depths, 64 container levels and 65,536 key/value nodes. The stdout cap remains 1 MiB including whitespace. Reject overflow even when an earlier retained prefix looks valid.
  • Keep diagnostic stderr independent: retain at most 4,096 bytes with replacement decoding, drain excess, and never expose raw diagnostics. Keep non-protocol tool text interfaces and process-group cleanup.
  • Apply the same command/native/request validator on normal and abnormal completion. Preserve nullable Claude names, omitted target agent, native UUID case and optional queue IDs; bind Claude PID/casefolded name, dry-run, explicit-home/selection and inactive opt-in context.
  • Preserve independently verified native facts after SSH 255 or collection timeout. Native ok, status, submitted, target and optional queue ID remain unchanged; local exit 1 plus client-owned sshTransport reports transport failure. Normal verified exits 0/1/2 retain their contract. No retry, fallback or failover.
  • Discard peer-supplied sshTransport; preserve unrelated additive fields. Reject contradictory success/error, refused/queue-ID and dry-run/queue-ID records. Explicit remote aliases use a receiver-derived, validated and stripped wire-only requestedCodexHome scalar; the caller never resolves remote paths locally.
  • Document the unreleased source contract in PARITY, all four guides, API notes and a focused response-contract document. Keep the Python 1.0.2 oracle and the immutable public npm 0.3.2 artifact unchanged.

Verification

Local macOS arm64, Node 24.16.0, with the Python oracle extracted from exact commit 47c23713d0a2a3c11ebde6186afd8c43489b8b65:

  • npm run build, npm run test:types, node scripts/check-repository.mjs, git diff --check: PASS.
  • Full exact-head npm test: 168 tests, 163 pass, 0 fail, 5 Windows-only skips. The affected parser/CLI/transport tests also passed separately (32 tests). Exact-head CI runs the full suite again.
  • npm run test:package: PASS, including isolated install/uninstall, declarations and bash/zsh shorthand contract/lifecycle. The first package attempt lacked this new worktree's local TypeScript dependency; npm ci --ignore-scripts in the isolated checkout resolved that environment failure.
  • npm audit: 0 vulnerabilities.
  • node scripts/release.mjs pack and node scripts/release.mjs artifact: PASS, 54 allowlisted files, source commit 8c882fab220ade044d00beb9d23bf6ecb7727bdc, local artifact SHA-256 deec9bbcd6ac4faefa21c9c601a1f4e4af1234c7037df34773ced2127b787c61. The first regeneration correctly refused this task's stale previous-head release-dist; that owned directory was archived before creating the exact-head artifact. This is a local development artifact, not a release/stage authorization.

New fixtures cover complete/partial/empty/polluted/invalid UTF-8 and duplicate-key output × exit 0/255/actual collection timeout; byte/depth/node boundaries; split multibyte UTF-8; invalid or excessive diagnostic stderr; requested-target/home/opt-in mismatches; queue-ID retention; ordered mixed-host isolation; reserved diagnostic spoofing; text warning; and exactly one request per host. The POSIX CLI fixture uses a test-only import to shorten the existing 90-second request deadline; no production test knob was added.

Portable parser/process cases are explicitly included in test:windows. The native Windows fixture adds complete Codex output + exit 255 + invalid diagnostic UTF-8 through the existing encoded-PowerShell path, with exactly one queue stand-in call. Windows execution is CI evidence only; the local POSIX transport.test.ts result is not presented as Windows validation.

Review and boundaries

Pre-PR source review findings were fixed and regression-tested: contradictory success/error, peer-owned transport diagnosis, missing home/opt-in binding, and explicit-home echo without a returned home. Automatic Code and Security Review completed on 0180fedae69f6c61c06362c705911e1f931269ed. Code Review reported four P2 findings; commit 8c882fab220ade044d00beb9d23bf6ecb7727bdc fixes all four and adds portable regressions across normal/abnormal completion: reject queue IDs in every failed send, refuse unknown submission facts for dry-run requests, require the selected absolute home in every successful Codex result, and bind remote doctor's SSH route evidence to the exact requested return destination. Security Review supplied no separate findings. A bounded read-only follow-up audit of the four changes confirmed consistency with actual send and remote probe contracts and found no remaining blocking defect; it did not execute live tests. Review completion is not claimed for the new commit; no separate review mentions were sent. Latest exact-head CI: cli run 37863835806, CodeQL run 37863832399. All 12 current-head checks passed without reruns, including CodeQL, macOS/Ubuntu Node 22/24, Windows native 22/24, repository policy, release gate and GitGuardian.

All execution used dedicated temporary fixtures/fake endpoints. No live delivery/ACK experiment, real SSH host, transcript access, credential use, native queue re-execution, installation of a user runtime/skill, protection change, merge, tag, release or npm publication occurred. Remote canonical-path alias mapping remains destination context evidence, not independent filesystem authentication or a generation guarantee. Submission is not injection, ACK or completed work. Human approval is the merge gate.

Merge preparation checkpoint — 2026-10-09 KST

Rebased onto the #125 merge 1c78a0c3977504ca8706f0d0077fd10db9d89ce4. Current head: 89464fd5243c8ad86f8b2771cf4a98b6389a49b9. The only conflict was PARITY.md; the accurate historical 0.3.2 record and new SSH correction section are both retained. Runtime/tests/release sources are byte-identical to reviewed head 8c882fab220ade044d00beb9d23bf6ecb7727bdc; changes relative to that head are the five #125 documentation files.

Local build, type tests, strict-response parser/CLI tests (17 passed, 0 failed), repository checker and diff check passed. Exact-head CI 37894499567 and CodeQL 37894496779 completed successfully (12/12 checks, Windows Node 22/24 included). Bound squash merge: 8f12972a37a0755904bdf6f20e4bfb4a0b9d6cbe. No protection/admin bypass was used.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T00:13:55.664477Z 0180fed PR opened
🔒 Security Review ✅ Completed 2026-10-09T00:10:24.562162Z 0180fed PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0180fedae6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/ssh-response.ts Resolved
Comment thread src/ssh-response.ts Resolved
Comment thread src/ssh-response.ts Resolved
Comment thread src/ssh-response.ts Resolved
@abruption
abruption force-pushed the fix/116-strict-ssh-response branch from 8c882fa to 89464fd Compare October 9, 2026 06:37
@abruption
abruption merged commit 8f12972 into main Oct 9, 2026
12 checks passed
@abruption
abruption deleted the fix/116-strict-ssh-response branch October 12, 2026 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(ssh): validate bounded raw response bytes and strict JSON framing fix(ssh): preserve complete native outcomes after transport shutdown

1 participant