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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emojis in domain names break mentions #20422

Open
mhlz opened this issue Nov 11, 2022 · 2 comments 路 May be fixed by #25890
Open

Emojis in domain names break mentions #20422

mhlz opened this issue Nov 11, 2022 · 2 comments 路 May be fixed by #25890
Labels
bug Something isn't working

Comments

@mhlz
Copy link

mhlz commented Nov 11, 2022

Steps to reproduce the problem

I tried setting up an instance on https://xn--og8haa.st/ (馃寛馃寛馃寛.st).

Unfortunately mentioning accounts that belong to this instance doesn't seem possible currently. Typing @username@ shows the right username in the picker. Selecting it adds @username@馃寛馃寛馃寛.st to the post, but when I post the status @username on my local instance gets mentioned instead.

I think this is because the MENTION_RE in

MENTION_RE = /(?<=^|[^\/[:word:]])@((#{USERNAME_RE})(?:@[[:word:]\.\-]+[[:word:]]+)?)/i
only considers word characters for domains.

Expected behaviour

Either the picker should complete the punycode representation or the parser should parse the emoji representation (I'd prefer the latter, but I admit, it's fairly esoteric)

Actual behaviour

The picker completes the username in a way that makes it look like the right person will be mentioned, but someone else ends up being mentioned.

Detailed description

No response

Specifications

Mastodon 4.0.0rc1
Firefox 106.0.5

@ineffyble
Copy link
Member

A lot of things enforce punycode these days, partially because of the potential for phishing/impersonation, and I think that's probably a risk here too (It would be very easy to miss that@Gargron@m伪stodon.social wasn't @Gargron@mastodon.social, for example), although if it was limited to only the emoji range it might be less of an issue? (not confident on that)

@mhlz
Copy link
Author

mhlz commented Jul 6, 2023

I recently set up my test instance again and sadly it's still a problem for mentions. If the server would parse @username@馃寛馃寛馃寛.st as a correct mention I think it should be usable.

I tested changing the MENTION_RE to recognize more things (and that works just fine), but, as you pointed out, that might be an issue for security.

Currently, however, the MENTION_RE would already work on something like @gargron@m邪stodon.social since the cyrillic "邪" is part of the [:word:] character class: https://rubular.com/r/eecBmLfDEofkZv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants