ockam
ockam copied to clipboard
detect, log and discard messages too large to be send on the wire
Observed behavior
Currently each individual ockam message is limited to up to 2^16 bytes when serialized. On the wire, messages are prepended with a 2bytes header indicating their length, following the encoded message itself.
But this is not really enforced when serializing. The size advertised on the wire is just truncated, and the message is sent anyway
Steps to reproduce
Can be easily tested using the existing examples on examples/rust/get_started
- Modify 04-routing-over-transport-initiator.rs so the message it sent is larger than
2^16 - Run
cargo run --example 04-routing-over-transport-responderto start the listener side - Run
cargo run --example 04-routing-over-transport-initiatorto launch the connecting side
The message will be tried to be send anyway, and an error will be reported on the responder side.
Expected behavior
We must detect if the msg size is larger than 2^16 , and if that's the case do not send the message, instead return a TransportError here when serializing the msg
That must be done on all transport where applicable, not only the TCP one (for example the uds one is affected too )
Ockam Version
v0.102.0
Hello, if issue #6880 is currently unassigned or available, please consider assigning it to me.
Sure, go ahead @prajwalgh ! And let us know if you have any questions 👍
hi, I looked into it and I think I can solve it.
https://github.com/build-trust/ockam/pull/7079