RFC 4254 describes the channels protocol, but it does not seem to contain any clear recommendation as to how to handle protocol errors - except for the channel setup phase. In other words, once a channel is established, there is no way to signal to the peer that it has violated the protocol by sending a malformed message, an unexpected one or even one that references an unknown channel.
The current code usually throws an exception that causes the session to terminate as well (except for EOF, CLOSE and WINDOW_ADJUST) - as demonstrated by
SSHD-776. The discussions of this issue have also raised the claim that the code should be "tolerant" as to such channel exception and not affect the whole session.
- Consider adding a ChannelErrorMessageHandler that users can register that can regulate this behavior and let the user decide how to handle the exception.
- Provide some built-in implementations - e.g., IGNORE (default ?) and FAIL (closes the session)