fix(server): offer only none SSH compression to avoid zlib@openssh.com desync (fixes #215)#217
Open
Yaminyam wants to merge 1 commit into
Open
fix(server): offer only none SSH compression to avoid zlib@openssh.com desync (fixes #215)#217Yaminyam wants to merge 1 commit into
none SSH compression to avoid zlib@openssh.com desync (fixes #215)#217Yaminyam wants to merge 1 commit into
Conversation
…com desync
Clients that negotiate delayed zlib (`zlib@openssh.com`) — Cyberduck,
`sftp -C` — completed the SFTP handshake and then dropped mid-session with
the server logging `SshEncoding: length invalid` on the next inbound packet.
Root cause is russh's delayed-zlib transport: the flate2 stream desyncs a
few packets after compression activates post-auth, so russh reads the next
packet's length prefix out of corrupted plaintext. Reproducible on both
russh 0.61.1 and 0.62.1 (rules out the channel-close path; it's compression,
not the SFTP layer). OpenSSH's default `sftp`, FileZilla, and paramiko all
negotiate `none` and were unaffected.
Set `russh::Preferred { compression: [NONE], ..DEFAULT }` in
`build_russh_config` so the server advertises only `none` and clients fall
back to the uncompressed transport — matching the Dropbear / OpenSSH
sftp-server defaults used in Backend.AI kernel containers, where compression
was never in play. Verified with `sftp -C` (negotiates `compression: none`)
and a live Cyberduck 9.5 session.
Fixes lablup#215.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Clients that negotiate delayed zlib (
zlib@openssh.com) — Cyberduck, or OpenSSHsftp -C— complete the SFTP handshake (INIT/REALPATH/STATall succeed) and then the connection dies, with the server loggingSshEncoding: length invalidon the next inbound packet.Root cause
russh's delayed-zlib transport. Compression activates after auth; a few packets later the flate2 stream desyncs, so russh reads the next packet's length prefix out of corrupted plaintext and aborts the session.
Confirmed it is compression, not the SFTP layer or the channel-close path:
sftp(default)nonenonenonesftp -Czlib@openssh.comSshEncoding: length invalidzlib@openssh.comSshEncoding: length invalidReproduces on both russh 0.61.1 (current fork) and 0.62.1, so it is independent of the SFTP session-close behaviour.
One-command repro (before this patch)
Fix
build_russh_confignow advertises onlynone:Every client falls back to the uncompressed transport. This matches the Dropbear / OpenSSH
sftp-serverdefaults used in Backend.AI kernel containers, where compression was never in play — so there is no functional loss for the intended deployment.Verification
sftp -Cnow negotiatesserver_compression: Noneand lists / downloads cleanly.cargo build/cargo clippyclean onmain(russh 0.61.1 fork).The underlying russh delayed-zlib desync is left to be fixed upstream; this patch is the safe server-side workaround.
Fixes #215.