Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

not all punycode-encoded domains work #8991

Open
Sorunome opened this issue Dec 26, 2020 · 10 comments
Open

not all punycode-encoded domains work #8991

Sorunome opened this issue Dec 26, 2020 · 10 comments
Labels
A-Federation O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Tolerable Minor significance, cosmetic issues, low or no impact to users. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. Z-Upstream-Bug This issue requires a fix in an upstream dependency.

Comments

@Sorunome
Copy link
Contributor

Sorunome commented Dec 26, 2020

Description

If you have a domain with only emoji and want to set your server_name to the punycode-encoded versoin of it (e.g. xn--9s9hnf.ws) the server is not able to federate.

This is because twisted.web.client uses the python package idna over here to check if a domain is valid. Editing that to use text.encode("idna") and text.decode("idna") fixes this issue.

Said idna package has an issue here about not supporting emoji domains, and from the sounds of it they do not plan to add it.

Soru would open this issue with the twisted package, but she couldn't find any way to open non-security-critical bug reports with them. This issue also affects synapse as, well, that does not allow you to have all punycode-encoded domains as your server_name, even though they are valid according to the spec etc.

@clokep clokep added the Z-Upstream-Bug This issue requires a fix in an upstream dependency. label Dec 28, 2020
@clokep
Copy link
Member

clokep commented Dec 28, 2020

If you have a domain with only emoji and want to set your server_name to the punycode-encoded versoin of it (e.g. xn--9s9hnf.ws) the server is not able to federate.

From reading through the linked issue it seems this is an invalid domain name, but domains similar to this exist "due to other non-standards compliant software".

Soru would open this issue with the twisted package, but she couldn't find any way to open non-security-critical bug reports with them.

See https://twistedmatrix.com/trac/newticket

FTR, xn--9s9hnf.ws converts to 🧡🦊.ws.

It is unclear to me whether these should be supported or not.

@Sorunome
Copy link
Contributor Author

Sorunome commented Dec 28, 2020

From reading through the linked issue it seems this is an invalid domain name, but domains similar to this exist "due to other non-standards compliant software".

Well, they work in normal webbrowsers, many even convert emojis to punycode for you. The fact that you can register such domains should make them valid, in sorus opinion.

See https://twistedmatrix.com/trac/newticket

Thank you!

@auscompgeek
Copy link
Contributor

I'm seeing a UnicodeEncodeError for that particular server name as well.

https://sentry.io/share/issue/46729566e17f4ce19b1b9af751888b68/

The offending line (on HEAD as of writing) is:

destination_bytes = self.destination.encode("ascii")

I'm not sure what the consequences of changing the encoding to utf-8 here would be though.

@Sorunome
Copy link
Contributor Author

Sorunome commented Dec 29, 2020 via email

@Sorunome

This comment has been minimized.

@clokep

This comment has been minimized.

@Sorunome

This comment has been minimized.

@Sorunome
Copy link
Contributor Author

Sorunome commented Jan 8, 2021

Managed to create a ticket by now: https://twistedmatrix.com/trac/ticket/10078#ticket

@clokep
Copy link
Member

clokep commented Mar 4, 2021

It seems kjd/idna#18 is the eventual upstream for this.

@DMRobertson DMRobertson added S-Tolerable Minor significance, cosmetic issues, low or no impact to users. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. O-Uncommon Most users are unlikely to come across this or unexpected workflow A-Federation labels Aug 25, 2022
@clokep
Copy link
Member

clokep commented Nov 17, 2022

Managed to create a ticket by now: twistedmatrix.com/trac/ticket/10078#ticket

For cross-linking, this is now twisted/twisted#10078.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Federation O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Tolerable Minor significance, cosmetic issues, low or no impact to users. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. Z-Upstream-Bug This issue requires a fix in an upstream dependency.
Projects
None yet
Development

No branches or pull requests

4 participants