element-hq / element-hq/synapse

Unused legacy fallback code for `public_key` response to `/_matrix/identity/v2/store-invite`

Open
#6,036 0 comments 0 reactions 0 assignees View on GitHub
A-Spec-Compliance O-Uncommon S-Tolerable T-Task Z-Cleanup
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

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

---

Noticed by @richvdh during review of https://github.com/matrix-org/synapse/pull/5979/files#r323956886

https://github.com/matrix-org/synapse/blob/c755955f335984dc6f97a269b57ad955f257ef8f/synapse/handlers/room_member.py#L1037-L1047

https://github.com/matrix-org/synapse/blob/c755955f335984dc6f97a269b57ad955f257ef8f/synapse/handlers/room_member.py#L873-L876

---

Original comment:

while I'm here (it's not really relevant to the review, but): wtf is going on here?

1. `public_key` isn't specced anywhere, afaict
2. if `public_key` isn't set, we set `fallback_public_key` to `public_keys[0]` which, according to the spec, has a completely different shape to what we claim to return. (Edit: fixed by https://github.com/matrix-org/matrix-spec/pull/1486)

The calling code seems to imply that `fallback_public_key` is only used to populate some fields "For backwards compatibility", but said fields are in the spec.

I'm not suggesting changing anything here as part of this PR, but it looks like there's some bogosity, which suggests to me that the code is either unused (so can be killed) or broken (so should be fixed).

Contributor guide

Open the contributing guide

Research direction

Start with synapse/handlers/room_member.py at the referenced lines 1037-1047 and 873-876, then compare the response with the Matrix identity specification and the linked review discussion. Determine whether the public_key and fallback_public_key handling is unused or incorrect; done means the legacy behavior is removed or corrected consistently with the specification.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.