Skip to content
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

HTTP Basic Authentication: Decode Base64 to UTF-8 #1486

Merged
merged 1 commit into from
Feb 14, 2024

Conversation

manubahr
Copy link
Contributor

Fitnesse basic authentication fails on non-ASCII characters (for example german umlauts) in user-id and passwords

fitnesse.util.Base64#decode(java.lang.String) incorrectly uses the charset UTF-8 (defined in FileUtil.CHARENCODING) to convert the input to Base64-decode(). This input's charset however is irrelevant because Base64 is US-ASCII which is compatible to any charset.
The output of Base64-decode() has to be converted to UTF-8 as most browsers encode basic auth in UTF-8 now.

For nearly all users this change will be without any effect as their user-ids / passwords are in US-ASCII which is fully compatible to UTF-8. Only users with Latin1 (ISO-8859-1) chars in user-id / passwords that managed to have their browser NOT to encode basic auth as UTF-8 (Safari? IE?) and their fitnesse installation's java default file encoding fitting their browser's encoding, will experience a change and authentication might fail. Remedy is to use a current web browser which encodes basic auth as UTF-8.

See:

Perhaps fitnesse should send the new "charset" auth-param from RFC-7617 to user agents to explicitly tell them that the "Authorization" header value is expected to be UTF-8 encoded (see https://datatracker.ietf.org/doc/html/rfc7617#section-2.1).

@manubahr manubahr changed the title Decode Base64 to UTF-8 as most browsers encode basic auth in UTF-8 now HTTP Basic Authentication: Decode Base64 to UTF-8 as most browsers encode basic auth in UTF-8 now Feb 11, 2024
@manubahr manubahr changed the title HTTP Basic Authentication: Decode Base64 to UTF-8 as most browsers encode basic auth in UTF-8 now HTTP Basic Authentication: Decode Base64 to UTF-8 Feb 11, 2024
@fhoeben fhoeben merged commit b9b9797 into unclebob:master Feb 14, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants