element-hq / element-hq/synapse
Perspective key server matrix.org returns keys multiple times for some entries
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
This issue has been migrated from [#15424](https://github.com/matrix-org/synapse/issues/15424).
---
This is an offshoot of #12736.
`rei@lithium ~$ curl https://matrix.org/_matrix/key/v2/query -d '{"server_keys": {"matrix.arsenm.dev": {"ed25519:a_TzAM": {}, "ed25519:ads3pX": {}}}}' | jq .`
```json
{
"server_keys": [
{
"old_verify_keys": {},
"server_name": "matrix.arsenm.dev",
"signatures": {
"matrix.arsenm.dev": {
"ed25519:a_TzAM": "oQgYwB7VF/PAc0Y/VeNBKIAeNGxGnKKdamacfqpmQLfm3IGjAUSDBwlamlZRgAT7Cp9yb1dqVPxQcfB2akWqBg"
},
"matrix.org": {
"ed25519:auto": "WMwuXWnDJuNbzCA3Pdc0ZfBgg0azw3SYl6SsksUrQXyKtu6uGAuiAOIjjXcuQP6hFB14ftgN6I8vkAd4sWqXDQ"
}
},
"tls_fingerprints": [],
"valid_until_ts": 1627273239740,
"verify_keys": {
"ed25519:a_TzAM": {
"key": "4FvovoVi9G7MIQuLtf415BM2ZkZoyR7XR7wpBHXSL9w"
}
}
},
{
"old_verify_keys": {
"ed25519:a_TzAM": {
"expired_ts": 1601024554498,
"key": "4FvovoVi9G7MIQuLtf415BM2ZkZoyR7XR7wpBHXSL9w"
}
},
"server_name": "matrix.arsenm.dev",
"signatures": {
"matrix.arsenm.dev": {
"ed25519:ads3pX": "TIwJM/GR0MOjIgLozTB0KexowbuMG8DRGu9DAQbMcVDAgUNwWVglce/9LPTrfq+g7qj73Ml3mAaUj9MBD6cmDQ"
},
"matrix.org": {
"ed25519:auto": "xuIzHyUzHqz7NL5t34GTCXSSh/rxhVOxktzJxT+LLRxY+9FlHQOJoRUPZJnBY2QjzgHmhWW3+JAoKOcoIlZQBw"
}
},
"valid_until_ts": 1627788036360,
"verify_keys": {
"ed25519:ads3pX": {
"key": "TGOiZYXHMEWCD6rgqiJhdrg7O4nN488jDPcj/V9b0xI"
}
}
}
]
}
```
`ed25519:a_TzAM` appears multiple times. There are multiple array entries for the same server name.
I'm not clear on how this is meant to work, but it seems suspicious and in any case it was causing #12736 (CardinalityViolation errors due to the keys being duplicated).
We should investigate to see whether this is unwanted and whether we should fix the perspective server to *not* return these duplicates.
Contributor guide
Research direction
Start by examining the /_matrix/key/v2/query response shown for matrix.arsenm.dev and the related #12736 CardinalityViolation report. Determine whether repeated server_keys entries and repeated key IDs violate the expected response, then confirm that the perspective server no longer produces unwanted duplicates.
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
- 35/100