mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04: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
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:
|
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
Block a user