summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2018-11-27 10:32:30 +0000
committerBrendan Abolivier <babolivier@matrix.org>2019-02-13 15:16:03 +0000
commitb071101729984737205a039c6dbb896d953fc6e0 (patch)
treec9682e626e19f2cc50c713a3d829b86e99ab1c08
parentuse right script (diff)
downloadsynapse-b071101729984737205a039c6dbb896d953fc6e0.tar.xz
Strip signatures and hashes on outgoing events
-rwxr-xr-xdocker/proxy/proxybin6308432 -> 6311584 bytes
-rw-r--r--synapse/event_auth.py2
-rw-r--r--synapse/federation/transaction_queue.py3
-rw-r--r--synapse/federation/units.py22
-rw-r--r--synapse/python_dependencies.py2
5 files changed, 25 insertions, 4 deletions
diff --git a/docker/proxy/proxy b/docker/proxy/proxy
index 06241e2500..8d94082137 100755
--- a/docker/proxy/proxy
+++ b/docker/proxy/proxy
Binary files differdiff --git a/synapse/event_auth.py b/synapse/event_auth.py
index 39e4bd2b11..db096f3d7d 100644
--- a/synapse/event_auth.py
+++ b/synapse/event_auth.py
@@ -46,7 +46,7 @@ def check(event, auth_events, do_sig_check=True, do_size_check=True):
     if not hasattr(event, "room_id"):
         raise AuthError(500, "Event has no room_id: %s" % event)
 
-    if do_sig_check:
+    if False and do_sig_check:  # Disable all sig checks
         sender_domain = get_domain_from_id(event.sender)
         event_id_domain = get_domain_from_id(event.event_id)
 
diff --git a/synapse/federation/transaction_queue.py b/synapse/federation/transaction_queue.py
index 7d476ffbb3..80536856a6 100644
--- a/synapse/federation/transaction_queue.py
+++ b/synapse/federation/transaction_queue.py
@@ -564,7 +564,7 @@ class TransactionQueue(object):
         except FederationDeniedError as e:
             logger.info(e)
         except Exception as e:
-            logger.warn(
+            logger.exception(
                 "TX [%s] Failed to send transaction: %s",
                 destination,
                 e,
@@ -620,6 +620,7 @@ class TransactionQueue(object):
         success = True
 
         logger.debug("TX [%s] _attempt_new_transaction", destination)
+        logger.debug("TX [%s] _attempt_new_transaction", destination)
 
         txn_id = str(self._next_txn_id)
 
diff --git a/synapse/federation/units.py b/synapse/federation/units.py
index 025a79c022..d278475d9a 100644
--- a/synapse/federation/units.py
+++ b/synapse/federation/units.py
@@ -117,6 +117,26 @@ class Transaction(JsonEncodedObject):
                 "Require 'transaction_id' to construct a Transaction"
             )
 
-        kwargs["pdus"] = [p.get_pdu_json() for p in pdus]
+        kwargs["pdus"] = [
+            _mangle_pdu(p.get_pdu_json())
+            for p in pdus
+        ]
 
         return Transaction(**kwargs)
+
+
+def _mangle_pdu(pdu_json):
+    pdu_json.pop("hashes", None)
+    pdu_json.pop("signatures", None)
+
+    pdu_json["auth_events"] = list(_strip_hashes(pdu_json["auth_events"]))
+    pdu_json["prev_events"] = list(_strip_hashes(pdu_json["prev_events"]))
+
+    return pdu_json
+
+
+def _strip_hashes(iterable):
+    return (
+        (e, {})
+        for e, hashes in iterable
+    )
diff --git a/synapse/python_dependencies.py b/synapse/python_dependencies.py
index 325e0a48fe..3197adbeed 100644
--- a/synapse/python_dependencies.py
+++ b/synapse/python_dependencies.py
@@ -68,7 +68,7 @@ REQUIREMENTS = {
     "netaddr>=0.7.18": ["netaddr"],
 
     "jaeger_client": ["jaeger_client"],
-    "opentracing": ["opentracing"],
+    "opentracing<2,>=1.2.2": ["opentracing"],
 }
 
 CONDITIONAL_REQUIREMENTS = {