AymDev / MessengerAzureBundle

A Symfony 4/5/6 bundle providing a Messenger transport for Azure Service Bus using the Azure REST API.
MIT License
10 stars 7 forks source link

V1.5.0 Breaking Change - parse_url() error with unescaped secret key #16

Closed ArthurJCQ closed 8 months ago

ArthurJCQ commented 8 months ago

Hi !

Since the last release (1.5.0) I encounter the following exception :

"Invalid Azure Service Bus DSN ..."

After a quick look, I noticed the parse_url function is now used to parse the DSN url.

Problem is : I have some unescaped characters in my secret key (especially a / character that breaks everything).

So came a few questions :

Maybe I am missing some good practice about formatting my secret key, in this case please tell me !

EDIT: I just saw there is a call to url_decode at some point, so it should decode the secret key correctly, but the other questions still stands :)

IronSean commented 8 months ago

WE've also experienced this since the update: https://github.com/AymDev/MessengerAzureBundle/commit/41c371dd4f6fb6c7ee152b024683bea01316197d#r138620999

AymDev commented 8 months ago

Hello and sorry for the unwanted breaking changes.

This behaviour won't be changed in v1.5 but is documented in v2.0.0 that I just released.

To answer each of your questions:

Can this be considered as a breaking change ? If so, a major version with this info in the release note would be better IMHO.

You are right, this is a breaking change. I don't want the behaviour to change (official Symfony Messenger transports also use parse_url to read the DSN) but I released a new major version with an upgrade document. The README also warns about this.

Am I supposed to have this kind of unescaped characters in my secret key ?

I can't tell but it looks like you are not the only one having special characters in your keys.

And, if I do escape it, the key won't be valid anymore to the azure service bus, right ? / character becoming %2F with urlencode for instance.

As you noticed, there is a urldecode() call later. URL encoding your keys is the right way to do.