mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-14 02:29:33 +01:00
fix: keep remote file reads out of the login shell's parser (release review)
The remote file reads ran under the user's login shell, quoted for a POSIX one. Under fish the probe was a parse error, so previews failed, and csh and tcsh failed every multi-line read. Wrapping the probe in sh -c as the review proposed would have opened a hole: fish reads \' inside single quotes as a quote, so nested shell quoting flips, and a path holding ';touch x;' ran touch x (measured, also on the existing folder listing). csh and tcsh run a multi-line command line by line, so a newline in a path did the same. buildRemoteFileCommand now sends every script as one word of printf text with those bytes in octal, and only sh reads it. Probe, folder listing, read, range read and transcript lookup gave the same result under bash, zsh, dash, fish, tcsh and csh in a throwaway container ($SHELL -c, no real sshd), and 24 hostile paths ran nothing. Plain csh caps a word near 8 KB, noted in the docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
800b3f4658
commit
82593a4dd6
4 files changed
+77
-13
No files matched your search
@@ -166,6 +166,15 @@ Key points:
|
||||
prerequisite probe's `command -v tmux` needs a `command` executable: macOS and the
|
||||
BSDs ship one, Debian and Ubuntu do not, so linking a tcsh host there is refused
|
||||
with `could not verify tmux`.
|
||||
- **File reads never leave a quote for the login shell** (`remoteLoginShellLine()` in
|
||||
`remote-files.ts`). Previews, downloads, folder grids and Edit history are multi-line
|
||||
POSIX scripts holding a path someone else may have named. fish reads `\'` inside
|
||||
single quotes as a quote, so the shell-quoted text flips in and out of quotes, and
|
||||
csh and tcsh end a command at a newline even inside quotes, so both ran part of a path
|
||||
as a command (measured). The script therefore crosses the login shell as one word of
|
||||
`printf` text with those bytes in octal, and only `sh` ever reads it. Plain csh caps
|
||||
a word at about 8 KB and answers `Word too long` for a larger read; tcsh has no such
|
||||
cap.
|
||||
- Connection options come from the **same `buildSshConnectionArgs(remote)`** as
|
||||
the prereq probe; `-t` is inserted right after `ssh -o BatchMode=yes`,
|
||||
preserving historical token order.
|
||||
|
||||
Reference in new issue
Block a user