You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, thank you for this library! I was experimenting with custom net.Listeners and it seems that Serve exits on any error from l.Accept unconditionally:
Unfortunately, this essentially causes server to shut down upon non-fatal errors. This potentially allows a DoS attack (shutting server down by maliciously closing connections as they're about to get accepted), although this is only my suspicion that I haven't properly validated. IIRC, TLS listener may return net.ErrClosed if something bad happens during the handshake, and even plain TCP connections may accidentally fail with ECONNRESET or ECONNABORTED. Either way, I believe a slightly more sophisticated loop would be an improvement.
Now Serve does not exit on non-fatal errors from Accept.
This resolvesemersion#180
It also logs handleConn errors to the ErrorLog - which is a partial
improvement for emersion#167
Hey, thank you for this library! I was experimenting with custom net.Listeners and it seems that
Serve
exits on any error froml.Accept
unconditionally:go-smtp/server.go
Lines 113 to 122 in f9aa4f4
Unfortunately, this essentially causes server to shut down upon non-fatal errors. This potentially allows a DoS attack (shutting server down by maliciously closing connections as they're about to get accepted), although this is only my suspicion that I haven't properly validated. IIRC, TLS listener may return
net.ErrClosed
if something bad happens during the handshake, and even plain TCP connections may accidentally fail withECONNRESET
orECONNABORTED
. Either way, I believe a slightly more sophisticated loop would be an improvement.Here's an adapted version based on how net/http does it:
(Possibly somewhat contradictory, those errors are marked as "temporary" - see golang/go#6163 for more details).
The text was updated successfully, but these errors were encountered: