mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-02 01:06:06 -04:00
Hash the same content covered by the signature when referencing previous PDUs rather than reusing the PDU content hashes
This commit is contained in:
parent
bb04447c44
commit
c8f996e29f
6 changed files with 84 additions and 16 deletions
|
@ -44,6 +44,8 @@ from .signatures import SignatureStore
|
|||
|
||||
from syutil.base64util import decode_base64
|
||||
|
||||
from synapse.crypto.event_signing import compute_pdu_event_reference_hash
|
||||
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
|
@ -165,7 +167,7 @@ class DataStore(RoomMemberStore, RoomStore,
|
|||
|
||||
for hash_alg, hash_base64 in pdu.hashes.items():
|
||||
hash_bytes = decode_base64(hash_base64)
|
||||
self._store_pdu_hash_txn(
|
||||
self._store_pdu_content_hash_txn(
|
||||
txn, pdu.pdu_id, pdu.origin, hash_alg, hash_bytes,
|
||||
)
|
||||
|
||||
|
@ -185,6 +187,11 @@ class DataStore(RoomMemberStore, RoomStore,
|
|||
hash_bytes
|
||||
)
|
||||
|
||||
(ref_alg, ref_hash_bytes) = compute_pdu_event_reference_hash(pdu)
|
||||
self._store_pdu_reference_hash_txn(
|
||||
txn, pdu.pdu_id, pdu.origin, ref_alg, ref_hash_bytes
|
||||
)
|
||||
|
||||
if pdu.is_state:
|
||||
self._persist_state_txn(txn, pdu.prev_pdus, cols)
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue