TROVE-2024-010: arti socks proxy has mis-eaten data bug?
I was working on my MR for #1590 (closed). One of the infelicities in the tor-socksproto API that I am trying to fix, is that it is easy for a caller of this API to accidentally discard non-SOCKS-handshake data (connection payload data) that was read-ahead while we performed the SOCKS handshake.
My reading of the code in crates/arti/src/socks.rs
is that it has precisely this bug. I'm attempting to convert it to my new API which means touching the code that handles the read-ahead data and integrating it with the new API's results mechanism.
But there doesn't seem to be any code to handle the read-ahead data.
I think read-ahead data could only happen here if the client sends payload data along the stream before receiving the SUCCEEDED message.
Does the SOCKS protocol specification absolutely forbid a client from doing that? Because I think if a client does, we would drop some of the data and possibly expose the client to a misframed data vulneerability.
CC @nickm