ergo
ergo copied to clipboard
consider relaxing PRECIS constraints for RELAYMSG relay nicks?
See #1437. The /
separator character can cause identifiers that are not obviously malformed to fail PRECIS.
Since we are not enforcing any kind of uniqueness or non-confusability requirement on spoofed RELAYMSG nicks, it may not actually be necessary for them to pass PRECIS. I'm thinking instead of making them pass CasefoldName
, we can have them pass a different check:
- If casemapping is PRECIS or permissive, just check for protocol-breaking characters
- If casemapping is ASCII, do the normal
foldASCII
check
I have some qualms since channel operators can send these in the default/recommended configuration...
Example problem as seen by Matterbridge
tammi 01 09:45:50 etro matterbridge[9445]: time="2021-01-01T09:45:50Z" level=debug msg="Sending RELAYMSG to channel #mikaela: nick=Leon🏳️🌈-[he/him/his]/m" func=doSend file="bridge/irc/irc.go:241" p refix=irc
tammi 01 09:44:17 etro matterbridge[9445]: time="2021-01-01T09:44:17Z" level=debug msg=""@time=2021-01-01T09:44:17.580Z :tuusula-fi.pirateirc.net FAIL RELAYMSG INVALID_NICK :Invalid nickname"" func=handleOther file="bridge/irc/handlers.go:163" prefix=irc
Oh how jlu5's net handles these characters: the matterbridge code just replaces all invalid/reserved chars with a -
I'm not sure how allowing identifiers that can't pass PRECIS will work for clients - I get the feeling we may already do it with how relaymsg works right now, but if clients are expecting to be able to run PRECIS casefolding on all incoming identifiers they may run into issues. Might be worth adding a note to our unicode identifiers spec explicitly stating this case and telling clients that "hey if you can't run it through precis then just, um, don't"
Do we have a unicode identifiers spec?
Some discussion on #1083 re. whether clients should be able to treat our identifiers as opaque byte strings.
This interacts weirdly with #1502; if we can't casefold the identifier then it's not clear how we're going to match it against bans.
Regarding this and #1684 splitting would it be possible to also strips @
s from RELAYMSGed nicknames? It would be another line I could remove from my matterbridge.toml
s as I have it to format MatrixIDs for non-RELAYMSG-capable networks.
I understand that not all stripping should be done on server side and some should possibly be left for clients.
I am still using Matrix IDs instead of display names in matterbridge so messages won't just disappear when Ergo cannot parse them and I have two awkward situations with it:
- Matrix IDs cannot be changed so my first name doesn't match between name and MXID.
- I have an user whose MXID length is the maximum 255 characters and apparently Ergo has no problem, while display name would be more human-friendly.
- If casemapping is ASCII, enforce all normal restrictions, else
- Enforce protocol-breaking characters
- Replace disfavored characters with a replacement (maybe
-
?) - Attempt to casefold with PRECIS
- If this fails, apply
foldPermissive
; if this fails, reject the message - The folded identifier from steps 4 or 5 is evaluated against bans/mutes