mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-22 01:25:44 +03:00
Limit the size of the aggregation_key (#12101)
There's no reason to let people use long keys.
This commit is contained in:
parent
31b125ccec
commit
61fd2a8f59
2 changed files with 4 additions and 0 deletions
1
changelog.d/12101.misc
Normal file
1
changelog.d/12101.misc
Normal file
|
@ -0,0 +1 @@
|
|||
Limit the size of `aggregation_key` on annotations.
|
|
@ -1069,6 +1069,9 @@ class EventCreationHandler:
|
|||
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
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue