-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Mailer / Amazon Mailer] Valid AWS secret key characters removed / throwing invalid DSN exception #36669
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
Hm. I had a similar issue in another DSN parser: Nyholm/dsn#12 The |
mailer/Transport/DSN.php urldecode username and password - you can check source code. so you need to encode username and password(replace + with %2B and etc urlencode()) Tricky part is that there is no ENV processor to urlencode value on the fly. so if you are constructing dsn in config you cant use default AWS_* envs but you should have: async aws sdk in symfony 5.1 should solve most of the issues i have with EC2 role authentication which is not supported right now :) |
Closing as @drekinov gave the current solution. |
While the solution does work, it is completely undocumented. I feel that in
order for this to be resolved, there needs to be something in the mailer
documentation that explains how to use special characters in DSN keys.
…On Wed, 10 Jun 2020, 18:00 Fabien Potencier, ***@***.***> wrote:
Closing as @drekinov <https://github.com/drekinov> gave the current
solution.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#36669 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAG4E4Z5RY2O6HNP7B7CF6TRV4OOPANCNFSM4MYCYNFQ>
.
|
You're right, can you open an issue on the docs repo? |
Hi @fabpot . I've submitted a docs PR. |
This PR was squashed before being merged into the 4.4 branch. Discussion ---------- Added a caution about encoding DSN credentials Refer to issue symfony/symfony#36669 Commits ------- e1da71c Added a caution about encoding DSN credentials
Symfony version(s) affected: 4.4.8
Description
I am setting up the Symfony Amazon mailer component and passed my AWS key and AWS secret to the mailer DSN. My AWS secret contains a
+
character in it, egA57+VZcaA
(obviously not a real key). I noticed I was getting signature errors.Adding a dump and echo to line 41 of Symfony\Component\Mailer\Bridge\Amazon\Transport\SesHttpTransport using the example secret above outputs the following;
https://pasteboard.co/J6ErpBL.png
As a workaround, I generated a new access key and secret, and this time it contains two / characters in it eg
...se/J1/0p
, and am getting the exception;How to reproduce
Setup symfony/mailer with the Amazon SES mailer.
Generate a access key and secret that has a + or / character in it.
Add;
to line 41 of Symfony\Component\Mailer\Bridge\Amazon\Transport\SesHttpTransport
Additional context
I also tried to reference a service parameter instead of a .env variable and the plus character was also removed from that as well.
When I edited the SesHttpTransport class and changed the $secretKey variable to my actual key in the constructor, the email was sent successfully.
In an attempt to figure out where the cause is a
dd($dsn)
on line 96 of Symfony\Component\Mailer\Transport shows the full correct key being presented to the Transport classes.A further dump on line 125 of the same class shows the secret with the + symbol removed.
The text was updated successfully, but these errors were encountered: