Routing key length is not validated

Open
#54 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp, rabbitmq

Research direction

Start with the topology.bind(exchange, queue, longRoutingKey) and producer->send(message, longRoutingKey, ...) entry points, then reproduce the attached sample with a routing key over 255 bytes. Trace where each operation handles the key and verify that oversized values are rejected without hanging or closing the connection.

Written by the indexing model from the issue text.

Description

The topic exchange routing key has a limitation of 255 bytes (see https://www.rabbitmq.com/tutorials/tutorial-five-go#:~:text=There%20can%20be%20as%20many,be%20in%20the%20same%20form.). However, this limitation is not applied when binding queue to an exchange or sending the message:

To Reproduce

  1. Specify a long routing key (>255 characters) when binging a queue to an exchange:
    topology.bind(exchange, queue, longRoutingKey);
    No errors will be reported but the process will hang forever.
  2. Specify a long routing key (>255 characters) when sending the message:
    producer->send(message, longRoutingKey, ...);
    The following error will be reported:
    13JAN2025_08:46:10.559653 350290 140737331340864 WARN /home/pasick/github/pasick-clean/rmqcpp/src/rmq/rmqio/rmqio_asioconnection.cpp 410 UNINITIALIZED_LOGGER_MANAGER Socket closed: Connection reset by peer. Current state: 1
    and the connection will be closed.

Please refer to the attached sample which demonstrates the issue:
longRoutingKeyIssue.txt

Expected behavior
I believe that the size of the routing key should be validated and do not accept values larger that 255 bytes.

Dominant language
C++
Stars
106
Forks
32
Avg merge
9h 6m
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bloomberg/rmqcpp

All issues in bloomberg/rmqcpp

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.