Skip to content

v0.4.2

Latest

Choose a tag to compare

@github-actions github-actions released this 31 Jul 17:55
v0.4.2
348c81f

What's New in charm.land/ssh v0.4.2

This release now makes it so that a panic while serving an SSH connection no longer takes down the entire server.

Every connection is served on its own goroutine with the the handshake and session handlers. Go has no process-wide panic handler, so a panic on any of those goroutines terminated the entire process and disconnected every other user crashing the process.

Panics are now contained to the connection that caused them, logged through log/slog with a stack trace, and the session ends with a non-zero exit status.

// A handler that panics used to kill the server. Not anymore!
ssh.ListenAndServe(":2222", func(s ssh.Session) {
    panic("oops")
})

There's nothing you need to do to configure this! If you're using wish's recover middleware you can keep using it though its no longer required. The two main changes are panics that were previously silent now log at error level and clients see a clean non-zero exit instead of a dropped connection.

Port forwarding and agent forwarding got the same treatment as well.


The Charm logo

Thoughts? Questions? We love hearing from you. Feel free to reach out on X, Discord, Slack, The Fediverse, Bluesky.