element-hq / element-hq/synapse

server_name is not correctly validated for join requests

Open
#7,108 0 comments 0 reactions 0 assignees View on GitHub
A-Validation z-bug z-p2
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

This issue has been migrated from [#7108](https://github.com/matrix-org/synapse/issues/7108).

---

### Description
Caused #4891 but is a problem by itself, too.

```
2020-03-19 16:02:39,463 - synapse.http.matrixfederationclient - 491 - WARNING - POST-591111- {GET-O-12659} [!NEdKsYgzazXzpqqeBT:grin.hu] Request failed: GET matrix://!NEdKsYgzazXzpqqeBT:grin.hu/_matrix/federation/v1/make_join/%21NEdKsYgzazXzpqqeBT%3Agrin.hu/%40grin%3Agrin.hu?ver=1&ver=2&ver=3&ver=4&ver=5&ver=org.matrix.msc2260: ValueError("invalid literal for int() with base 10: b'grin.hu'")

2020-03-19 16:02:39,463 - synapse.util.retryutils - 218 - INFO - POST-591111- Connection to !NEdKsYgzazXzpqqeBT:grin.hu was unsuccessful ((Failed to send request: ValueError: invalid literal for int() with base 10: b'grin.hu')); backoff now 600000

2020-03-19 16:02:39,464 - synapse.federation.federation_client - 421 - WARNING - POST-591111- Failed to make_join via !NEdKsYgzazXzpqqeBT:grin.hu

2020-03-19 16:02:39,465 - synapse.http.server - 81 - INFO - POST-591111- SynapseError: 502 - Failed to make_join via any server
```

### Steps to reproduce
I don't know, I only became aware of this when it completely broke communities.

### Version information
- **Homeserver**:
matrix.grin.hu
- **Version**:
v1.11.1-1 (debian)

- **Install method**:
debian experimental repo.

- **Platform**:
Debian/Sid/x64

Contributor guide

Open the contributing guide

Research direction

Start with the logged client join request and trace how the server_name query parameter is parsed and validated during federation make_join handling. The issue provides no reproduction steps or named files/tests; done should mean malformed server_name values are rejected cleanly rather than causing the shown ValueError and 502 failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.