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
|
@ -0,0 +1 @@
|
||||||
|
Limit the size of `aggregation_key` on annotations.
|
|
@ -1069,6 +1069,9 @@ class EventCreationHandler:
|
||||||
if relation_type == RelationTypes.ANNOTATION:
|
if relation_type == RelationTypes.ANNOTATION:
|
||||||
aggregation_key = relation["key"]
|
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(
|
already_exists = await self.store.has_user_annotated_event(
|
||||||
relates_to, event.type, aggregation_key, event.sender
|
relates_to, event.type, aggregation_key, event.sender
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue