-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Ensure that an OTP's issuer and label values are escaped correctly #391
Conversation
I discovered the same problem yesterday, thank you for the fix! Also, MS Authenticator does not support unescaped URLs, so that fix is really important. |
Thanks for this fix, it addresses issue #375. I suggest also escaping the |
Thanks @tom-156842, done 👍 |
@codebude Do you have any update on when this fix will be released? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
All changes here look good. Generated QR codes scan properly with Google Authenticator. Tests have already been added 👍 |
Summary
This PR fixes/implements the following bugs/features:
What existing problem does the pull request solve?**
Currently, if you create an OTP with an issuer that contains a space, for example:
and then call
ToString
on thatoneTimePassword
, that will return:otpauth://totp/Google Google:test@google.com?secret=pwq65q55&issuer=Google%20Google
(note the first "Google Google" is not escaped, like the second one in the
issuer
parameter)which then looks like this in Google Authenticator after scanning the resulting QR code:
This PR resolves this issue by correctly escaping both instances of the issuer in the URL, which then appears correctly in Google Authenticator:
otpauth://totp/Google%20Google:test@google.com?secret=pwq65q55&issuer=Google%20Google
Test plan
Test cases have been added.
Closing issues
N/A