mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-17 03:39: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
@@ -321,7 +321,7 @@ describe('planRemoteEditSourceRounds', () => {
|
||||
|
||||
it('keeps every ssh line under the 128 KiB argv limit, longest names and offsets included', () => {
|
||||
// 255 bytes is the longest file name a filesystem allows; a request without `len` is the
|
||||
// longer one, because its `''` costs 13 bytes per quote once shellescaped twice.
|
||||
// longer one, because its `''` costs 16 bytes per quote once escaped and encoded.
|
||||
const requests: EditSourceRequest[] = Array.from({ length: 5000 }, (_, i) => ({
|
||||
relPath: `subagents/agent-${String(i).padStart(6, '0')}${'x'.repeat(237)}.jsonl`,
|
||||
offset: Number.MAX_SAFE_INTEGER,
|
||||
|
||||
Reference in new issue
Block a user