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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix idna and ipv6 literal handling in MatrixFederationAgent #4487

Merged
merged 2 commits into from Jan 28, 2019

Conversation

3 participants
@richvdh
Copy link
Member

richvdh commented Jan 27, 2019

Turns out that the library does a better job of parsing URIs than our
reinvented wheel. Who knew.

There are two things going on here. The first is that, unlike
parse_server_name, URI.fromBytes will strip off square brackets from IPv6
literals, which means that it is valid input to ClientTLSOptionsFactory and
HostnameEndpoint.

The second is that we stay in bytes throughout (except for the argument to
ClientTLSOptionsFactory), which avoids the weirdness of (sometimes) ending up
with idna-encoded values being held in unicode variables. TBH it probably
would have been ok but it made the tests fragile.

Fix idna and ipv6 literal handling in MatrixFederationAgent
Turns out that the library does a better job of parsing URIs than our
reinvented wheel. Who knew.

There are two things going on here. The first is that, unlike
parse_server_name, URI.fromBytes will strip off square brackets from IPv6
literals, which means that it is valid input to ClientTLSOptionsFactory and
HostnameEndpoint.

The second is that we stay in `bytes` throughout (except for the argument to
ClientTLSOptionsFactory), which avoids the weirdness of (sometimes) ending up
with idna-encoded values being held in `unicode` variables. TBH it probably
would have been ok but it made the tests fragile.

@richvdh richvdh force-pushed the rav/fed_routing/fix_ipv6 branch from affe9ca to a22d4dd Jan 27, 2019

@codecov-io

This comment has been minimized.

Copy link

codecov-io commented Jan 27, 2019

Codecov Report

Merging #4487 into develop will decrease coverage by <.01%.
The diff coverage is 100%.

@@             Coverage Diff             @@
##           develop    #4487      +/-   ##
===========================================
- Coverage    74.71%   74.71%   -0.01%     
===========================================
  Files          336      336              
  Lines        34102    34099       -3     
  Branches      5544     5544              
===========================================
- Hits         25481    25476       -5     
- Misses        7048     7050       +2     
  Partials      1573     1573

@richvdh richvdh requested a review from matrix-org/synapse-core Jan 28, 2019

@richvdh richvdh added this to To Do in Homeserver Task Board via automation Jan 28, 2019

@richvdh richvdh moved this from To Do to In progress in Homeserver Task Board Jan 28, 2019

@richvdh richvdh merged commit d840019 into develop Jan 28, 2019

5 checks passed

ci/circleci: sytestpy2merged Your tests passed on CircleCI!
Details
ci/circleci: sytestpy2postgresmerged Your tests passed on CircleCI!
Details
ci/circleci: sytestpy3merged Your tests passed on CircleCI!
Details
ci/circleci: sytestpy3postgresmerged Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@richvdh richvdh deleted the rav/fed_routing/fix_ipv6 branch Jan 28, 2019

@hawkowl hawkowl moved this from In progress to Done in Homeserver Task Board Jan 28, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment