Skip to content

fix: harden Codex delivery, CLI parsing, SSH and output (#49-#57) - #62

Merged
abruption merged 1 commit into
mainfrom
fix/49-57-hardening
Sep 28, 2026
Merged

abruption merged 1 commit into
mainfrom
fix/49-57-hardening

Conversation

@abruption

Copy link
Copy Markdown
Owner

Summary

Resolves the 0.2.1 reliability and hardening findings from the 2026-09-28 audit. Behavior is tightened only; no new command, transport or schema field.

Issue Change
Closes #49 Codex queue and the SSH request pass the body as a single --message=<text> argument, so - item, --help, -x, -- and -1 are delivered as text.
Closes #50 An inherited CODEX_SQLITE_HOME (case-insensitive on Windows) is removed from the native queue environment. A home whose config.toml sets sqlite_home is refused as unsupported_codex_sqlite_home (codex_config_unreadable when it cannot be read) in both dry-run and send, and doctor reports it as unsupported.
Closes #51 A separate value that is exactly an option name (--message --dry-run, --to --dry-run, -m --json) is invalid_option (exit 2), matching Python argparse. --message=<text>, stdin and -- <text> still carry such text.
Closes #52 A verified SSH response keeps the remote 0/1/2 exit code locally.
Closes #53 Reply-To codexHome must be a POSIX or Windows absolute path, matching the Python reference.
Closes #54 Text output also escapes U+061C, U+200B–U+200F, U+202A–U+202E, U+2060–U+2069 and U+FEFF. JSON is unchanged.
Closes #55 A preflight with exit 0 and the exact version line passes regardless of stderr; stderr classification applies only to failed preflights.
Closes #56 Every PowerShell single-quote variant (', U+2018–U+201B) is doubled in the encoded --remote-bin command.
Closes #57 A .cmd/.bat executable found first on PATH (or given explicitly) is executable_unsupported in send and doctor; no shell is introduced.

PARITY.md gains a section describing these source changes.

Type

  • feat
  • fix
  • docs
  • chore / refactor / test / perf

Validation

  • npm ci --ignore-scripts and npm run build
  • SESSION_PEER_PYTHON_ROOT=/path/to/pinned/reference npm test — 75 tests: 71 pass, 4 skipped (Windows-only), 0 fail
  • npm run test:package and npm audit — package smoke pass, 0 vulnerabilities
  • Latest CI release gate passes with an up-to-date base
  • Behavior changes include relevant tests; refused/unknown/queued/ACK remain distinct
  • README changes are synchronized in EN/KO/JA/zh-CN (no README change)
  • No credentials, real messages, session IDs, agent homes or local evidence in the diff

The 8 new or updated regression tests were confirmed to fail against the previous source and pass with this change. codex queue --message=<body> was checked against codex-cli 0.157.1 with an empty temporary CODEX_HOME and a nonexistent thread (reaches the expected "no rollout" error for --help and - item); nothing was queued.

Tested environments / limitations

  • macOS arm64, Node 22.14.0, pinned Python reference 47c2371; fixtures only, no live sessions.
  • Windows-specific tests (.cmd shim refusal and the updated contract expectations for --message=) run only in the Windows CI jobs.
  • A live Codex writer started with its own CODEX_SQLITE_HOME cannot be observed from outside; this is documented in PARITY.md.
  • The PowerShell quoting test decodes the generated command on POSIX; it is not executed by PowerShell locally.

Release impact

No automatic release or deployment. Behavior changes that callers may notice: --message --flag style invocations are now refused, SSH usage refusals exit 2 instead of 1, and homes with sqlite_home or Windows batch shims are refused explicitly. SSH endpoints must run the same version (existing requirement), which covers the --message= wire change. No native dependency or JSON schema change.

- Pass Codex bodies as --message=<text> locally and over SSH (#49).
- Drop inherited CODEX_SQLITE_HOME and refuse a configured sqlite_home (#50).
- Refuse an option name consumed as a separate option value (#51).
- Propagate the verified remote exit code (#52).
- Require an absolute codexHome in Reply-To URIs (#53).
- Escape bidi and zero-width characters in text output (#54).
- Accept a verified SSH preflight before classifying stderr (#55).
- Double every PowerShell single-quote variant in --remote-bin (#56).
- Report Windows .cmd/.bat shims as executable_unsupported (#57).
@abruption abruption added the bug Something isn't working label Sep 28, 2026
@abruption
abruption merged commit 1f346ff into main Sep 28, 2026
9 checks passed
@abruption
abruption deleted the fix/49-57-hardening branch September 28, 2026 12:06
@abruption abruption mentioned this pull request Sep 28, 2026
8 of 11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment