Issues

Select view

Select search mode

 
50 of

Upgrade JID class to RFC 7622 / Allow German letters in resource parts

Description

German "Umlauts" like ü, ö, ä, ... are currently disallowed by the JID class, leading to the following error, which prevents users to login to Openfire with resources containing german umlauts, e.g. "Büro" (== "office").

Resource parts in JIDs follow the rule:

The resourcepart of a JID is an instance of the OpaqueString profile
of the PRECIS FreeformClass, which is specified in RFC7613

The FreeFormClass is specified here and allows "LetterDigits" which include the Unicode category "Ll - Lowercase_Letter".

"ü", "ä", "ö", etc. are in this Unicode category and therefore should be allowed in resource parts.

The JID class should be upgraded to RFC 7622 because it uses the old RFC 6122 and the obsolete Stringprep spec, which has been superseded by PRECIS.

(This issue can probably be moved to Tinder project, but I have no rights to do so).

2015.12.06 15:16:14 org.jivesoftware.openfire.handler.IQHandler - Interner Serverfehler java.lang.IllegalArgumentException: The input is not a valid JID resource: B?ro at org.xmpp.packet.JID.resourceprep(JID.java:421) at org.jivesoftware.openfire.handler.IQBindHandler.handleIQ(IQBindHandler.java:94) at org.jivesoftware.openfire.handler.IQHandler.process(IQHandler.java:65) at org.jivesoftware.openfire.IQRouter.handle(IQRouter.java:380) at org.jivesoftware.openfire.IQRouter.route(IQRouter.java:123) at org.jivesoftware.openfire.spi.PacketRouterImpl.route(PacketRouterImpl.java:76) at org.jivesoftware.openfire.net.StanzaHandler.processIQ(StanzaHandler.java:330) at org.jivesoftware.openfire.net.ClientStanzaHandler.processIQ(ClientStanzaHandler.java:93) at org.jivesoftware.openfire.net.StanzaHandler.process(StanzaHandler.java:295) at org.jivesoftware.openfire.net.StanzaHandler.process(StanzaHandler.java:187) at org.jivesoftware.openfire.nio.ConnectionHandler.messageReceived(ConnectionHandler.java:177) at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:690) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:417) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:47) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:765) at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:109) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:417) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:47) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:765) at org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(ProtocolCodecFilter.java:407) at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:236) at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:417) at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:47) at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:765) at org.apache.mina.core.filterchain.IoFilterEvent.fire(IoFilterEvent.java:74) at org.apache.mina.core.session.IoEvent.run(IoEvent.java:63) at org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.runTask(OrderedThreadPoolExecutor.java:769) at org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.runTasks(OrderedThreadPoolExecutor.java:761) at org.apache.mina.filter.executor.OrderedThreadPoolExecutor$Worker.run(OrderedThreadPoolExecutor.java:703) at java.lang.Thread.run(Thread.java:745) Caused by: gnu.inet.encoding.StringprepException: Contains prohibited code points. at gnu.inet.encoding.Stringprep.resourceprep(Stringprep.java:276) at gnu.inet.encoding.Stringprep.resourceprep(Stringprep.java:232) at org.xmpp.packet.JID.resourceprep(JID.java:407) ... 29 more

Environment

None

is related to

Details

Assignee

Reporter

Priority

Created January 26, 2016 at 1:13 PM
Updated February 23, 2022 at 7:52 PM

Activity

Show:

Guus der KinderenFebruary 23, 2022 at 7:52 PM

I’ve had an initial go at this, by looking at how many of the ~250.000 usernames that we have (that pass nodeprep) would fail PRECIS’s verification. No duplicates seemed to occur, but a very small number of values (less than 70) got rejected. Our sizeable sample probably leans towards western-based locales.

While discussing PRECIS in the XSF, I found that barely anyone actually uses PRECIS, and that its adoption comes at significant cost (particularly around s2s interop). See https://logs.xmpp.org/xsf/2022-02-22?p=h for the chat log. Given all of that, I’m a lot less inclined to move to PRECIS in the near future. I wonder if the benefits outweigh the costs.

cshJune 24, 2019 at 7:41 AM

I am wondering about the stacktrace, too. I assume it was a client encoding issue then.

Guus der KinderenJune 21, 2019 at 7:33 AM

Ah, thanks for this. I thought I was loosing my sanity.

Although this might be an entirely different issue: what caused your original stack trace? As far as I know, all paths (in Openfire/Tinder) that lead to resourceprep use UTF-8, not another encoding.

cshJune 20, 2019 at 6:47 PM

You are right. I took a wrong assumption just from reading the stacktrace, but it was probably some other encoding issue, like this:

String s = new String("Büro".getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8); JID.resourceprep(s);

(which fails).

I'll give another example:

OGHAM SPACE MARK' (U+1680) is allowed in PRECIS (mapped to normal space 0020), but is disallowed by the current implementation (tested with Tinder 1.3.0)

JID.resourceprep("should\u1680not throw");

Guus der KinderenJune 20, 2019 at 8:10 AM

Note that once applied, persisted data (in the Openfire database) needs to be scrubbed. See https://tools.ietf.org/html/rfc7613#section-6

Flag notifications