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

Commit

Permalink
Do not reject /sync requests with unrecognised filter fields
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Sean Quah committed Nov 4, 2022
1 parent e5d1895 commit 3128451
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions changelog.d/14369.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +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.
8 changes: 4 additions & 4 deletions synapse/api/filtering.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
from synapse.server import HomeServer

FILTER_SCHEMA = {
"additionalProperties": False,
"additionalProperties": True, # Allow new fields for forward compatibility
"type": "object",
"properties": {
"limit": {"type": "number"},
Expand All @@ -63,7 +63,7 @@
}

ROOM_FILTER_SCHEMA = {
"additionalProperties": False,
"additionalProperties": True, # Allow new fields for forward compatibility
"type": "object",
"properties": {
"not_rooms": {"$ref": "#/definitions/room_id_array"},
Expand All @@ -77,7 +77,7 @@
}

ROOM_EVENT_FILTER_SCHEMA = {
"additionalProperties": False,
"additionalProperties": True, # Allow new fields for forward compatibility
"type": "object",
"properties": {
"limit": {"type": "number"},
Expand Down Expand Up @@ -143,7 +143,7 @@
},
},
},
"additionalProperties": False,
"additionalProperties": True, # Allow new fields for forward compatibility
}


Expand Down

0 comments on commit 3128451

Please sign in to comment.