Skip to content

Answer SFTP limits from the sandbox server - #86

Merged
czpython merged 1 commit into
mainfrom
gateway-sftp-limits
Oct 27, 2026
Merged

czpython merged 1 commit into
mainfrom
gateway-sftp-limits

Conversation

@czpython

Copy link
Copy Markdown
Owner

Closes #85.

asyncssh's SFTP server answers limits@openssh.com from its own constants, a 4 MiB write, and never asks the SFTPServer. A client that honours the answer, such as asyncssh 2.24 with put at its default block size, sends a file under 4 MiB as one write packet. The sandbox's OpenSSH sftp-server ends the session on a packet of 256 KiB or more, so every upload of that size failed with SFTPConnectionLost.

Change

  • The backend asks the sandbox server its limits after the handshake, in the order asyncssh's own client uses. A failure there tears the process down like a failed handshake.
  • GatewaySFTPServer.limits returns that answer, and a caller's limits@openssh.com request is routed to it beside the existing extension filter. A sandbox server without the extension leaves the client's 16 KiB default in place.
  • Two tests: the advertised write length fits the sandbox server's packet, and a 300 KiB put at the client's default block size round-trips. Both fail on main, the second with the production error.
  • The test sftp-server also resolves at the Debian path, so the SFTP tests run on Linux instead of skipping. They skipped in CI until now.
  • One sentence in the deploy guide, and the checklist's truthiness rule applied in the touched files.

Verification

uv run pytest: 857 passed. ruff check, ruff format --check, pyright: clean.

asyncssh's SFTP server answers limits@openssh.com from its own constants,
a 4 MiB write, and never asks the SFTPServer. A client that honours the
answer sends a file under 4 MiB as one write packet. The sandbox's
OpenSSH sftp-server ends the session on a packet of 256 KiB or more, so
every upload of that size failed with a lost connection.

The backend now asks the sandbox server its limits after the handshake,
and the gateway answers a caller's request with them. A sandbox server
without the extension leaves the client's 16 KiB default in place.

The test sftp-server resolves at the Debian path too, so the SFTP tests
run on Linux instead of skipping.
@czpython
czpython merged commit 36308d5 into main Oct 27, 2026
6 checks passed
@czpython
czpython deleted the gateway-sftp-limits branch October 27, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gateway SFTP advertises asyncssh's 4 MiB write limit; the sandbox server accepts 256 KiB

1 participant