You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(ssh/sftp): cap remote file reads on received bytes, not stat() size
The SFTP/SSH download routes buffered a remote file into memory with the
only size guard being sftp.stat().size — a value the caller-supplied SSH
server controls. A server that reports a tiny size and then streams
endlessly drove unbounded heap growth until OOM.
Add readSftpFileCapped(), which counts received bytes and destroys the
stream as soon as the cap is exceeded, and route all four SFTP-reading
tool routes through it (download, download-file, read-file-content, and
the append path of write-file-content, which had no cap at all). Cap
breaches now return 400 instead of 500, and responses report the actual
byte count rather than the server-reported stat size.
0 commit comments