Issue with Escaping Passwords Containing Special Characters When Using rabbitmqctl.bat (RabbitMQ 3.10.6) #11432
-
I encountered an issue when trying to add a user with a password containing special characters using Reproduction steps
$username = "testUser6"
$password = 'w63pnZ&LnYMO(t'
Start-Process -FilePath "rabbitmqctl.bat" -ArgumentList "add_user $username $password" -NoNewWindow -Wait I have tried escaping the special characters and quoting the password, but the issue persists. Here are the approaches I tried: Escaping characters in PowerShell: $escapedPassword = $password -replace '([&^<>"!|()])', '^$1'
$quotedPassword = "`"$escapedPassword`""
Start-Process -FilePath "cmd.exe" -ArgumentList "/c rabbitmqctl.bat add_user $username $quotedPassword" -NoNewWindow -Wait This results in the same error. Modifying the batch script to handle the escaped characters did not resolve the issue. System Information:RabbitMQ Version: 3.10.6 Expected behaviorThe user should be added successfully, regardless of the special characters in the password. Actual Behavior:The command fails with an error indicating that parts of the password are not being interpreted correctly:
Workaround Attempts:Didn't found anyone. Additional Context:The issue appears to be related to how the shell interprets special characters in the password string when passed to the batch file. This issue significantly affects the usability of rabbitmqctl.bat for managing users with complex passwords, which is a common security requirement. Any guidance or fixes to handle passwords with special characters would be greatly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 7 replies
-
Please start by testing 3.13/OTP26. |
Beta Was this translation helpful? Give feedback.
-
I'll try. Any additional hints? Are there any special characters that are actually not supported? |
Beta Was this translation helpful? Give feedback.
-
@moerwald please see the scripts I have added here: https://github.com/lukebakken/rabbitmq-server-11432 This will start RabbitMQ 3.13.3 locally: https://github.com/lukebakken/rabbitmq-server-11432/blob/main/run-rabbitmq-server.ps1 This will attempt to add a user with special chars in the password. Notice that it uses https://github.com/lukebakken/rabbitmq-server-11432/blob/main/add-user.ps1 You'll notice that it is the
I'm continuing to investigate. I will add a |
Beta Was this translation helpful? Give feedback.
-
@moerwald - here's how I found PowerShell scripts to work with RabbitMQ: https://www.google.com/search?q=powershell+rabbitmq+HTTP+api https://stackoverflow.com/questions/29403042/using-powershell-to-create-user-in-rabbitmq-via-api |
Beta Was this translation helpful? Give feedback.
-
The doc guide that explains how to add users using |
Beta Was this translation helpful? Give feedback.
@moerwald - well, that was easy. All you have to do is use double quotes inside the single quoted string:
lukebakken/rabbitmq-server-11432@e3dbc49