Skip to content
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

Problem with SQS DSN string with + in secret #481

Closed
dgoujard opened this issue Jul 30, 2018 · 6 comments
Closed

Problem with SQS DSN string with + in secret #481

dgoujard opened this issue Jul 30, 2018 · 6 comments

Comments

@dgoujard
Copy link
Contributor

dgoujard commented Jul 30, 2018

Hello,

When i had secret with an "+" in the DSN, the print_r in this file show me a space : https://github.com/php-enqueue/sqs/blob/master/SqsConnectionFactory.php#L61

Array
(
    [key] => NOTEXIST
    [secret] => uQLwixxVbX0bmCVI9RMvx A4LDxKRc5YcIy1xepe
    [token] => 
    [region] => eu-west-1
    [retries] => 3
    [version] => 2012-11-05
    [lazy] => 
    [endpoint] => 
)

This space generate 403 error in SQS api:

Error executing "CreateQueue" on "https://sqs.eu-west-1.amazonaws.com"; AWS HTTP error: Client error: `POST https://sqs.eu-west-1.amazonaws.com` resulted in a `403 Forbidden` response:                      
  <?xml version="1.0"?><ErrorResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><Error><Type>Sender</Type><Code>S (truncated...)                                                                       
   SignatureDoesNotMatch (client): The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for d  
  etails.  

I regenerated multiple access keys to got one without + in the secret. I think the cause is the parse_url here : https://github.com/php-enqueue/enqueue-dev/blob/master/pkg/sqs/SqsConnectionFactory.php#L137
I think we can use replace function but it's maybe there are other char other than + with this issue.

@reganlawton
Copy link

@dgoujard The issue is the DSN is being passed through parse_url() and if you urlencode your secret it'll work. Annoying but a simple fix.

@makasim
Copy link
Member

makasim commented Aug 2, 2018

everything after ? in the DSN should be urlencoded. That's expected behavior.

@makasim makasim closed this as completed Aug 2, 2018
@reganlawton
Copy link

@makasim Thats a good point and 100% correct

@dgoujard
Copy link
Contributor Author

dgoujard commented Aug 2, 2018

@makasim As DSN is an url it's seam legit but maybe it's need to be mentioned in the documentation ?

@makasim
Copy link
Member

makasim commented Aug 2, 2018

@dgoujard yeap, good idea. PR is welcome.

@reganlawton
Copy link

I feel the docs DO need a touch up on the SQS side

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

No branches or pull requests

3 participants