Skip to content

Unable to specify password with special chars in DSN #652

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jeff1985 opened this issue Nov 22, 2018 · 5 comments · Fixed by #656
Closed

Unable to specify password with special chars in DSN #652

jeff1985 opened this issue Nov 22, 2018 · 5 comments · Fixed by #656
Milestone

Comments

@jeff1985
Copy link
Contributor

With the recent change and introduction of enqueue/dsn (https://github.com/php-enqueue/dsn/blob/master/Dsn.php) I'm not able to specify a password with special chars in the DSN string. Before I was using it with the following syntax:

rediss://hostname?timeout=10&pass=XXXX%2Fs%3D

I'm using a major cloud provider for the redis resource, the password is auto-generated and always contains special chars. Before I was using urlencode to pass the special chars as parameter and it was working fine.

Now as I see, I have to specify the password in the "user:pass@host" syntax, so it would be something like this:

rediss://user:XXXX%2Fs%3D@hostname?timeout=10
  1. How can I leave out the user? I dont have a user for the connection. Only a "key"=password.
  2. If done like this, the password will not be decoded, and the server will report failed authentication.
  3. I also can not pass the password as is, because then parse_url is not able to parse it at all!

Easy to verify:

php > echo parse_url("rediss://user:XXXX%2Fs%3D@host.com/", PHP_URL_PASS);
XXXX%2Fs%3D
php > echo parse_url("rediss://user:XXXX".urldecode("%2Fs%3D")."@host.com/", PHP_URL_PASS);
php >
@makasim
Copy link
Member

makasim commented Nov 22, 2018

as a workaround you could try:

# config/config.yaml

enqueue:
  default:
    transport: 
       dsn: 'rediss://host.com'
       password: 'aPassword'

@makasim makasim added the bug label Nov 22, 2018
@makasim makasim added this to the 0.9 milestone Nov 22, 2018
@jeff1985
Copy link
Contributor Author

the workaround gives me the following error:

The service "enqueue.client.consume_command" has a dependency on a non-existent parameter "enqueue.default_client".

Not sure, how to deal with it?

@makasim
Copy link
Member

makasim commented Nov 22, 2018

# config/config.yaml

enqueue:
  default:
    transport: 
       dsn: 'rediss://host.com'
       password: 'aPassword'
    client: ~

@makasim
Copy link
Member

makasim commented Nov 23, 2018

@jeff1985 does a major cloud provider suggest using pass or password query parameter? What does their DSN look like?

@makasim
Copy link
Member

makasim commented Nov 23, 2018

@jeff1985 once #656 is merged you could define a password

rediss://user:password@host - password is password
rediss://user@host - user is password
rediss://host?password=password - password as query parameter

They are taken in this order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants