Removal of some chars in tokens which can cause problems when sent via email (plus, slash, equals) - #217
Open
MassiveHiggsField wants to merge 2 commits into
Open
Removal of some chars in tokens which can cause problems when sent via email (plus, slash, equals)#217MassiveHiggsField wants to merge 2 commits into
MassiveHiggsField wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The current createToken method can create tokens which include chars that can cause some encoding issues later (e.g. "+", "/" and the trailing "="). Symfony's UrlSigner has already adapted a fix for that, see here.
I was a bit confused that this problem is not more widespread. Maybe it is because of some setup of our mail service... There seems to have been someone with a similar problem some time ago here #135 , but the user seems to have fixed it on their end.
We are seeing these problems when a generated token includes "+" or "/" in the URL. These result in something like this as token parameter in the URL:
After sending this mail through our mail service in production, the url will be changed to:
This must be some automatic encoding/parsing from the service itself, but since there might be other people using similar settings, UrlSigner also used these changes and there is no real loss in the change, it might be a good idea to implement it :)
Lastly, i have implemented it in a way, that already generated and sent token links will still work after an update. That might not really be needed though, idk.
If anyone finds this here because he has the same problems, if you are using it in a normal symfony application you can override the Generator this way (services.yaml):
And create a class like this:
Be advised of course that tokens that were already sent via mail before patching, will not work anymore.