-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
PhpSerializer does not comply with Amazon SQS requirements for message body #49844
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
Comments
Hey, thanks for your report! |
Could I get an answer? If I do not hear anything I will assume this issue is resolved or abandoned. Please get back to me <3 |
This is still relevant and there were no proposed path as which way should we go. |
You can write your own serializer that will fill Amazon requirements |
Haha, I know how to solve it for myself. But that does not solve the bug inside symfony's SQS implementation, does it? Current implementation is broken as it produces messages that are rejected by SQS. Is it edge case? Given the interest, sur it is. But I still believe this should be fixed. |
Where do you see bug inside "symfony's SQS implementation"? Package |
I would not replace the unicode filter in |
@croensch I am pretty sure, there is a default serializer instantiated from inside the sqs transport constructor, so it is pretty basic to replace Thank you for pointing out the XML, it didn't occur to me as XML-related limitation, it makes a lot more sense now. Considering speed, maybe there is already some kind of validator that'd detect invalid characters without regexping the whole message. |
@mrblur yes the sqs transport constructor has a nullable / auto serializer dependency. But in the factory it's not nullable so i guess it actually is injected by the bundle if you use the convenient yaml notation? |
Hey, thanks for your report! |
We have run into this issue this week. Are we basically saying it won't be fixed in |
The implementation of the Serializer is pretty easy https://github.com/symfony/symfony/compare/5.4...VincentLanglet:symfony:amazonSerializer?expand=1 But the issue is the fact the defaultSerializer is injected by this config symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php Lines 1545 to 1551 in 9c9d571
symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php Line 2157 in 9c9d571
symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php Lines 2184 to 2191 in 9c9d571
And I'm not sure what would be the right way to avoid a BC break. Any recommendation @nicolas-grekas for such dynamic dependency injection ? Comme so far the only idea I have would be to add
which doesn't looks idea the best code... Edit: I think I found a solution |
…e body (VincentLanglet) This PR was squashed before being merged into the 5.4 branch. Discussion ---------- [Messenger] Comply with Amazon SQS requirements for message body | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #49844 | License | MIT Commits ------- 0d441bf [Messenger] Comply with Amazon SQS requirements for message body
Symfony version(s) affected
5.4
Description
It is possible to encode a message payload that contains characters forbidden by Amazon SQS.
PhpSerializer
used by default checks for binary streams and encodes them using base64, but it fails on detecting all characters forbidden by Amazon.How to reproduce
Dispatch a message encoding a string containing illegal control character, like "vertical tab":
Possible Solution
The test done by
PhpSerializer
seems insuficient:I would proposed to replace that
if
statement with:We may also make that test configurable, or just implement own serializer for
amazon-sqs-messenger
using base64 encoding.Additional Context
https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_SendMessage.html
The text was updated successfully, but these errors were encountered: