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
{{ message }}
Repository navigation
Decode encoded AMQP URI values when no port is specified in spring-boot-amqp-rabbitmq #52818
In module/spring-boot-amqp-rabbitmq, RabbitUri.of(String) does not decode URL-encoded values (username, password, and virtual host) if no port is explicitly specified in the URI.
Lines 106-110 of module/spring-boot-amqp-rabbitmq/src/main/java/org/springframework/boot/amqp/rabbitmq/autoconfigure/RabbitUri.java:
When a port is specified, decode(...) is called on line 114, but when no port is specified, raw encoded values like us%3Aer or p%40ss are returned.
This issue was previously resolved for module/spring-boot-rabbitmq in gh-52644, but module/spring-boot-amqp-rabbitmq was not updated to match.
Additionally, in module/spring-boot-amqp-rabbitmq/src/test/java/org/springframework/boot/amqp/rabbitmq/autoconfigure/RabbitUriTests.java, the test method determineVirtualHostWhenHasNoUserDefinedVirtualHost contains a copy-paste assertion checking determinePassword instead of determineVirtualHost.
Steps to Reproduce
Parse a URI without a port containing encoded characters:
RabbitUriuri = RabbitUri.of("amqp://us%3Aer:p%40ss@localhost/my%2Fvhost");
// Currently produces username "us%3Aer", password "p%40ss", and virtual host "my%2Fvhost"// Expected: username "us:er", password "p@ss", and virtual host "my/vhost"
Suggested Fix
Update RabbitUri.java in module/spring-boot-amqp-rabbitmq to return decoded values when no port is specified:
Add unit tests in RabbitUriTests.java covering port-less URIs with encoded credentials and virtual hosts, and fix the assertion in determineVirtualHostWhenHasNoUserDefinedVirtualHost.
I would like to work on this issue and submit a PR.
Activity
philwebb commentedon Nov 16, 2026
Closing in favor of PR #52819. Thanks @manthansharma6767!