-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
fix issuer of OTP URI should be URI-encoded. #6634
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6634 +/- ##
==========================================
- Coverage 41.45% 41.44% -0.01%
==========================================
Files 442 442
Lines 59610 59611 +1
==========================================
- Hits 24712 24708 -4
- Misses 31667 31673 +6
+ Partials 3231 3230 -1
Continue to review full report at Codecov.
|
Could you give an example of an otp library that doesn't work? |
OK how do we fix this? I think we need to make this issuer label configurable and put a warning in the documentation somewhere that the default may not work on older otp parsing libraries. |
examples: OTPAuth.URI.parse("otpauth://totp/%E5%96%B5%20%E3%81%A8%20Nyaa%20%28https://old.huihui.cat%29:user?algorithm=SHA1&digits=6&issuer=%E5%96%B5+%E3%81%A8+Nyaa+%28https%3A%2F%2Fold.huihui.cat%29&period=30&secret=WHY5IXDH5S73SGA5")
parse("otpauth://totp/%E5%96%B5%20%E3%81%A8%20Nyaa%20%28https://old.huihui.cat%29:user?algorithm=SHA1&digits=6&issuer=%E5%96%B5+%E3%81%A8+Nyaa+%28https%3A%2F%2Fold.huihui.cat%29&period=30&secret=WHY5IXDH5S73SGA5")
|
* fix: Issuer of OTP URI should be URI-encoded. follow this link https://github.com/google/google-authenticator/wiki/Key-Uri-Format . * filter unsafe character ':' in issuer * Use Replace rather than ReplaceAll
I noticed that the URI of gitea totp 2fa would be failed parsed in some OTP parse libs.
Original URI like this
otpauth://totp/%E5%96%B5%20%E3%81%A8%20Nyaa%20%28https://old.huihui.cat%29:user?algorithm=SHA1&digits=6&issuer=%E5%96%B5+%E3%81%A8+Nyaa+%28https%3A%2F%2Fold.huihui.cat%29&period=30&secret=WHY5IXDH5S73SGA5
:
appeared twice and other programs could parse the incorrect issuer here.Following Google's OTP URI Format,