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

Limit the size of the aggregation_key #12101

Merged
merged 4 commits into from
Mar 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/12101.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Limit the size of `aggregation_key` on annotations.
3 changes: 3 additions & 0 deletions synapse/handlers/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,9 @@ async def _validate_event_relation(self, event: EventBase) -> None:
if relation_type == RelationTypes.ANNOTATION:
aggregation_key = relation["key"]

if len(aggregation_key) > 500:
raise SynapseError(400, "Aggregation key is too long")

already_exists = await self.store.has_user_annotated_event(
relates_to, event.type, aggregation_key, event.sender
)
Expand Down