summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-06-10 15:56:36 +0100
committerGitHub <noreply@github.com>2019-06-10 15:56:36 +0100
commit0382b0ffee272713c692a04b78ed19a10badcfc4 (patch)
treecfada4863b446e5d9899e11f12e009c89e35b697 /synapse
parentMerge pull request #5412 from SohamG/fix-4130 (diff)
parentNewsfile (diff)
downloadsynapse-0382b0ffee272713c692a04b78ed19a10badcfc4.tar.xz
Merge pull request #5415 from matrix-org/erikj/fix_null_valid_until_ms
Fix key verification when key stored with null valid_until_ms
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/keys.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/synapse/storage/keys.py b/synapse/storage/keys.py
index 5300720dbb..e3655ad8d7 100644
--- a/synapse/storage/keys.py
+++ b/synapse/storage/keys.py
@@ -80,6 +80,14 @@ class KeyStore(SQLBaseStore):
 
             for row in txn:
                 server_name, key_id, key_bytes, ts_valid_until_ms = row
+
+                if ts_valid_until_ms is None:
+                    # Old keys may be stored with a ts_valid_until_ms of null,
+                    # in which case we treat this as if it was set to `0`, i.e.
+                    # it won't match key requests that define a minimum
+                    # `ts_valid_until_ms`.
+                    ts_valid_until_ms = 0
+
                 res = FetchKeyResult(
                     verify_key=decode_verify_key_bytes(key_id, bytes(key_bytes)),
                     valid_until_ts=ts_valid_until_ms,