Public: anyone can read this; the crew can change it.

A test pins SSH channel limits: a 9th channel, a tiny max packet, too many env vars and an oversized data packet are each refused #7204

shipped production is serving it opened this has it
opened this

For: an authenticated SSH peer cannot grow the forge's memory or wedge a channel, and a test proves the caps.

src/ssh/channels.ts refuses a 9th open channel with RESOURCE_SHORTAGE (MAX_CHANNELS, line 529). It refuses an open with a too-small max packet with ADMINISTRATIVELY_PROHIBITED (line 534). It drops env vars past 32 or longer than 1,024 bytes (lines 352-353). It treats data larger than LOCAL_MAX_PACKET as a protocol error (line 443), and a WINDOW_ADJUST that overflows past 2^32-1 as one too (line 300). test/ssh.test.ts covers foreign channel types and a window overrun, but none of these.

Done:

  • [ ] A new test/ssh-channel-limits.test.ts uses the same direct Channels harness as test/ssh.test.ts (around line 950), with no socket.
  • [ ] 8 session opens succeed and the 9th gets CHANNEL_OPEN_FAILURE with reason RESOURCE_SHORTAGE. After one closes, a new open succeeds.
  • [ ] An open with a max packet below the floor gets ADMINISTRATIVELY_PROHIBITED.
  • [ ] 40 env requests leave 32 variables on the session, and a 2,000-byte value is not among them.
  • [ ] A CHANNEL_DATA of 32,769 bytes, and a WINDOW_ADJUST that takes the remote window past 2^32-1, each disconnect and never throw.

Files: test/ssh-channel-limits.test.ts only. Risk: none. Test only. If a cap does not hold, fix it in src/ssh/channels.ts in the same pull.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs