Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 3128451

Browse files
author
Sean Quah
committed
Do not reject /sync requests with unrecognised filter fields
For forward compatibility, Synapse needs to ignore fields it does not recognise instead of raising an error. Fixes #14365. Signed-off-by: Sean Quah <[email protected]>
1 parent e5d1895 commit 3128451

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

changelog.d/14369.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a long-standing bug where Synapse would raise an error when encountering an unrecognised field in a `/sync` filter, instead of ignoring it for forward compatibility.

synapse/api/filtering.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
from synapse.server import HomeServer
4444

4545
FILTER_SCHEMA = {
46-
"additionalProperties": False,
46+
"additionalProperties": True, # Allow new fields for forward compatibility
4747
"type": "object",
4848
"properties": {
4949
"limit": {"type": "number"},
@@ -63,7 +63,7 @@
6363
}
6464

6565
ROOM_FILTER_SCHEMA = {
66-
"additionalProperties": False,
66+
"additionalProperties": True, # Allow new fields for forward compatibility
6767
"type": "object",
6868
"properties": {
6969
"not_rooms": {"$ref": "#/definitions/room_id_array"},
@@ -77,7 +77,7 @@
7777
}
7878

7979
ROOM_EVENT_FILTER_SCHEMA = {
80-
"additionalProperties": False,
80+
"additionalProperties": True, # Allow new fields for forward compatibility
8181
"type": "object",
8282
"properties": {
8383
"limit": {"type": "number"},
@@ -143,7 +143,7 @@
143143
},
144144
},
145145
},
146-
"additionalProperties": False,
146+
"additionalProperties": True, # Allow new fields for forward compatibility
147147
}
148148

149149

0 commit comments

Comments
 (0)