security(pty,sftp): fix PTY cwd injection/recording/crashes & harden + upgrade SFTP manager

This commit is contained in:
tyuXX 2026-11-27 22:42:33 +00:00
parent 716627afdd
commit 838e69ba4e
6 changed files with 605 additions and 94 deletions

View file

@ -567,9 +567,10 @@ export class MockSshServer {
rawCommand: string,
): { stdout: Buffer; stderr?: string; exitCode: number } | null {
// Support streamed SFTP folder archive command in integration tests
const tarMatch = /tar -C ('(?:[^']|'\\'')*'|\S+) -cf - ('(?:[^']|'\\'')*'|\S+) \| gzip -c/.exec(
rawCommand,
);
const tarMatch =
/tar (?:--one-file-system )?-C ('(?:[^']|'\\'')*'|\S+) -cf - (?:-- )?('(?:[^']|'\\'')*'|\S+) \| gzip -c/.exec(
rawCommand,
);
if (tarMatch) {
try {
const virtualParent = unquoteSinglePosix(tarMatch[1]!);