-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
Login Failure with OpenID Connect Due to Incorrect Base64 Decoding of Japanese Characters in JWT #388
Comments
Is that reproducible on the demo when you set the accounts' name to contain non-ascii characters and then log in again? |
I'm unable to reproduce this with a local account on the demo with a display name set to Japanese or an openid account with a Japanese name. Can you add more details about how to reproduce this? |
From your analysis, it seems like this is not specific to Japanese characters in the token? |
Sorry for the delayed reply. Thank you for your feedback. I tested by setting the account name to “日本語憂鬱髙” and confirmed that the issue occurs when decoding the Base64 payload containing Japanese characters in the JWT token. |
Did you reproduce it on the demo? |
On the demo, I can't use OpenID Connect, so I can't reproduce the issue. |
But can you reproduce it on the demo if you change the name in the settings? |
It seems like the issue is related to OpenID Connect, not just the name change in the settings. The problem appears to be in transferring OpenID token-related data. |
I've created a test account with the name If you're seeing the problem in the frontend, it might be unrelated to openid auth since the openid auth token is parsed on the server only. |
Description
The current implementation of base64 decoding in the frontend application leads to incorrect handling of non-ASCII characters, specifically Japanese characters. This leads to a complete login failure when processing user information extracted from JWT tokens received during the OpenID Connect login flow.
Current behavior
The code responsible for decoding the base64-encoded payload of the JWT token (obtained via OpenID Connect) incorrectly replaces only the first instance of - with + and _ with /. Additionally, it fails to properly decode non-ASCII characters.
Steps to reproduce
Additional context
The current code for base64 decoding in
frontend/src/stores/auth.ts
is:This code only replaces the first instance of - and _. A correct implementation should use regular expressions with the g (global) flag to replace all occurrences.
Reference
This issue is similar to a problem reported in the microsoft-authentication-library-for-js repository: AzureAD/microsoft-authentication-library-for-js#985
Note
I am including the code directly in this report because my Gitea account is not yet approved. I apologize for any inconvenience this may cause.
Vikunja Version
v0.24.6
Browser and version
Chrome/131.0.6778.206
Can you reproduce the bug on the Vikunja demo site?
No
Screenshots
No response
The text was updated successfully, but these errors were encountered: