Ticket #801 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

[PATCH] OsmConnection assumes ASCII strings for authentication

Reported by: danilo@… Owned by: framm
Priority: major Component: Core
Version: latest Keywords: authentication, utf-8
Cc:

Description

Being the i18n guy that I am, I push all the technologies to their max, and I chose "Данило" (Cyrillic Danilo) for my username on OpenStreetMap.

This caused problems with JOSM when authenticating (for HTTP Basic Authentication), because Base64.encode used assumed that a string it was passed was consisted of 8-bit safe Unicode characters, however Cyrillic is outside this range (0x400–0x47f).

To fix this, I downloaded JOSM from SVN and first CharsetEncoder.encode()d the username and password, and passed that to an almost identical implementation of Base64.encode() but which takes ByteBuffer as a parameter.

My Java coding is certainly lacking (I've only rarely do some), and even stylistically, I could not figure out if there was any coding standard in use (spaces and tabs are used interchangeably in the sourcecode). Also, if this was code I would be maintaining, I'd remove the Base64.encode(String) method, because that one is easily misused (maybe make it Base64.encode(String, String charset) instead?)

However, the attached patch made it possible for me to upload changes to OSM server.

This bug is a "blocker" for me, but I've left it as the default "major" priority, because I suspect you determine priority based on other criteria as well.

Attachments

josm-utf8-logins.patch Download (3.9 KB) - added by danilo@… 2 years ago.
UTF-8 support for authentication

Change History

Changed 2 years ago by danilo@…

UTF-8 support for authentication

Changed 2 years ago by anonymous

  • summary changed from OsmConnection assumes ASCII strings for authentication to [PATCH] OsmConnection assumes ASCII strings for authentication

Changed 2 years ago by framm

  • status changed from new to closed
  • resolution set to fixed

Patch applied in r662. Please note that I am exactly of the opposite mindset - instead of "pushing technologies to the max" in order to run into as many problems as possible, I tend to *still* write all my e-mails in 7-bit ASCII even though my native language would normally require at least latin-1. If it is possible to have JOSM support fancy usernames without trouble then there is nothing to say against your patch but if it causes any problems for those who don't "push technologies to the max" and just want to get on with their work, then we'll have to revert it ;-)

Changed 2 years ago by danilo@…

Hi framm, thanks for applying the patch. I suspect nobody will have problems with the patch, because previously it worked correctly for anything in Latin-1, and now it works for Latin-1 and entire UTF-8 supported range.

Of course, I'd be happy to help debug and solve the problems anyone runs into, since now I'm already addicted to OSM and JOSM in particular :)

Add/Change #801 ([PATCH] OsmConnection assumes ASCII strings for authentication)

Author


E-mail address and user name can be saved in the Preferences.


Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.