mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-09-29 00:19:28 -04:00
Do not include signatures/hashes in make_{join,leave,knock} responses. (#10404)
These signatures would end up invalid since the joining/leaving/knocking server would modify the response before calling send_{join,leave,knock}.
This commit is contained in:
parent
bdfde6dca1
commit
d427f64724
3 changed files with 18 additions and 6 deletions
|
@ -291,6 +291,20 @@ class EventBase(metaclass=abc.ABCMeta):
|
|||
|
||||
return pdu_json
|
||||
|
||||
def get_templated_pdu_json(self) -> JsonDict:
|
||||
"""
|
||||
Return a JSON object suitable for a templated event, as used in the
|
||||
make_{join,leave,knock} workflow.
|
||||
"""
|
||||
# By using _dict directly we don't pull in signatures/unsigned.
|
||||
template_json = dict(self._dict)
|
||||
# The hashes (similar to the signature) need to be recalculated by the
|
||||
# joining/leaving/knocking server after (potentially) modifying the
|
||||
# event.
|
||||
template_json.pop("hashes")
|
||||
|
||||
return template_json
|
||||
|
||||
def __set__(self, instance, value):
|
||||
raise AttributeError("Unrecognized attribute %s" % (instance,))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue