amqp icon indicating copy to clipboard operation
amqp copied to clipboard

Parameters exceeding maximum length are silently truncated

Open deadok22 opened this issue 7 years ago • 2 comments

The library silently truncates parameters exceeding maximum length set by the protocol (see writeShortstr and writeLongstr).

That results in many unexpected behaviors such as:

  • Unexpected exchanges, queues, rounting keys, etc being used
  • Dropping message deliveries without acks or nacks when consumer tag exceeds maximum length (see #306)

I want to provide a pull request for this, so I wonder what would be the best way to fix this. I see two approaches that can possibly be combined:

  • Fail writeShortstr and writeLongstr calls upon truncation
  • Validate all properties supplied by users in all relevant function calls (e.g. in Channel.Consume)

Both approaches break compatibility with older versions. Please, let me know what you think.

deadok22 avatar Nov 22 '17 13:11 deadok22

Please submit a PR.

michaelklishin avatar Mar 07 '18 22:03 michaelklishin

I personally would say we should add validation to individual methods (such as Channel#Consume). Failing serialization is likely going to return messages that are not as useful as we can make them if we have the complex function invocation context (no pun intended).

michaelklishin avatar Mar 15 '18 18:03 michaelklishin