element-hq / element-hq/synapse

AS API sends events in V1 format

Open
#6,452 0 comments 0 reactions 0 assignees View on GitHub
A-Application-Service T-Enhancement 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 [#6452](https://github.com/matrix-org/synapse/issues/6452).

---

### Description

When pushing an event from synapse to an Application Service then all the keys in `unsigned` get cloned to the normal event body. As such, an event can look like so:

```
{
age: 1570,
content: { avatar_url: null, displayname: '_botty_fox', membership: 'invite' },
event_id: '$uoHrm1ILVwggnnWqXi2gURxKpyqgozD0lBigTjUVhMI',
origin_server_ts: 1575369872179,
prev_content: { membership: 'leave' },
replaces_state: '$E-PtVzqRyyqRIMxhTmbO2gH_qIOUEtMS0QKTQ4woj1Q',
room_id: '!Grimhoof_Forsakes_Starlight_Glimmer:localhost',
sender: '@test:localhost',
state_key: '@_botty_fox:localhost',
type: 'm.room.member',
unsigned: {
age: 1570,
prev_content: { membership: 'leave' },
prev_sender: '@_botty_fox:localhost',
replaces_state: '$E-PtVzqRyyqRIMxhTmbO2gH_qIOUEtMS0QKTQ4woj1Q'
},
user_id: '@test:localhost'
}
```

As you can see, `age`, `prev_content`, `prev_sender` and `replaces_state` have all been copied to the event body. This is not spec compliant, as the `Event` type in the spec only specifies those keys for the `unsigned` block.

### Steps to reproduce

- Send an event to an AS and look at the raw event data

### Version information

- **Homeserver**: local testing homeserver, running newest master branch

- **Version**:
```
sorunome@sorunome-desktop ~ $ curl http://localhost:8008/_synapse/admin/v1/server_version
{
"python_version": "3.8.0",
"server_version": "1.6.1 (b=master,e7777f366)"
}
```

- **Install method**: `git clone` and python virtual env w/ pip install

- **Platform**: archlinux

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.