Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Messenger] Fixed query string parsing #41427

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

Conversation

iamyukihiro
Copy link

@iamyukihiro iamyukihiro commented May 28, 2021

Q A
Branch? 5.2
Bug fix? yes
New feature? no
Deprecations? no
Tickets -
License MIT
Doc PR -

Hi!
I love Symfony, it's a very useful framework.

While using it, I found a bug and would like to make a pull request.

The secret_key issued by Amazon SQS may contain a "+".

Before the fix, when you parse A+a+A, there was a problem that you cannot access Amazon SQS because of the unintended change as follows.
(This is the change that happens when using parse_str().)

Run parse_str()

before

A+a+A

after

A a A

In this pull request, we will fix it to use the exact secret_key by changing it to not use parse_str().

@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has a contribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (see https://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (see https://symfony.com/releases)
  • Features and deprecations must be submitted against the 5.4 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@YaFou
Copy link
Contributor

YaFou commented May 28, 2021

This seems to broke some parameters with special characters including % for instance. Can you provide a test?

@iamyukihiro
Copy link
Author

@YaFou
I'll write the test 👍

@iamyukihiro iamyukihiro force-pushed the fix-amazon-sqs-query-string-parse branch from fd74d28 to 786c074 Compare May 28, 2021 13:18
@iamyukihiro
Copy link
Author

iamyukihiro commented May 28, 2021

@YaFou
I tried to parse % with parse_str() and it seems to work fine.
It seems that only + is a problem.

I thought I needed to test the parsing process, which can be complicated, so I divided it into classes and wrote tests for them.

@YaFou
Copy link
Contributor

YaFou commented May 28, 2021

No, I mean special characters that use % like %26 is equal to & in an URL.

@iamyukihiro
Copy link
Author

@YaFou
I've committed the test for special characters.
Is my interpretation correct? 😊

@derrabus derrabus added this to the 5.4 milestone May 30, 2021
Copy link
Contributor

@YaFou YaFou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moreover, you need to rebase the branch to 5.2 because it is a bug fix.

@iamyukihiro iamyukihiro force-pushed the fix-amazon-sqs-query-string-parse branch from 6bf1062 to 4e17e3f Compare June 1, 2021 12:57
@iamyukihiro iamyukihiro changed the base branch from 5.4 to 5.2 June 1, 2021 12:57
@iamyukihiro
Copy link
Author

@YaFou
I understand. I'll commit again. 👍

@iamyukihiro iamyukihiro force-pushed the fix-amazon-sqs-query-string-parse branch from 4bf3d92 to 22d9281 Compare June 1, 2021 13:59
@iamyukihiro iamyukihiro force-pushed the fix-amazon-sqs-query-string-parse branch from 22d9281 to 3e6e7b6 Compare June 1, 2021 14:18
@iamyukihiro
Copy link
Author

@derrabus
Sorry to bother you!
Please change Milestone to 5.2 🙏

@nicolas-grekas nicolas-grekas modified the milestones: 5.4, 5.2 Jul 12, 2021
@nicolas-grekas
Copy link
Member

We should avoid doing custom encoding for DSNs. I'm thus 👎
Instead, you should encode the + and turn them into %2B.
Alternatively, wouldn't using sqs://id:secret@default work?

@iamyukihiro
Copy link
Author

@nicolas-grekas

We should avoid doing custom encoding for DSNs. I'm thus 👎
Instead, you should encode the + and turn them into %2B.

Okay. 👍

Alternatively, wouldn't using sqs://id:secret@default work?

I tried it this way.
There seems to be a need to encode.

Is this behavior expected?

## NG

sqs://id:secret+@default

## OK

sqs://id:secret%2B@default

@Tobion
Copy link
Contributor

Tobion commented Jul 14, 2021

I'm also 👎 on this as this is not necessarily a bug. PHP treats query strings as url-form-encoded. There + means space.
So if you want to make sure to get a +, you need to rawurlencode the parameters as Nicolas pointed out.
Closing therefore.

@Tobion Tobion closed this Jul 14, 2021
OskarStark added a commit to symfony/symfony-docs that referenced this pull request Jul 21, 2021
…cess_key and secret_key (77web)

This PR was merged into the 5.2 branch.

Discussion
----------

[Messenger] add description to amazon-sqs-transport's access_key and secret_key

Added description according to reviews to this PR symfony/symfony#41427

Commits
-------

e10d284 add description to amazon-sqs-transport's access_key and secret_key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.