summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-11-23 11:31:53 +0000
committerErik Johnston <erik@matrix.org>2016-11-23 11:31:53 +0000
commitb69f76c1069ac4daa570102ab3dac0bf08e8dcc1 (patch)
treeb3b53d30e85bc26946c988ccc478f130b6f1c452 /synapse/storage
parentComment (diff)
parentMerge pull request #1640 from matrix-org/kegan/sync-perf (diff)
downloadsynapse-b69f76c1069ac4daa570102ab3dac0bf08e8dcc1.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/split_out_fed_txn
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/filtering.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/synapse/storage/filtering.py b/synapse/storage/filtering.py
index 5248736816..a2ccc66ea7 100644
--- a/synapse/storage/filtering.py
+++ b/synapse/storage/filtering.py
@@ -16,6 +16,7 @@
 from twisted.internet import defer
 
 from ._base import SQLBaseStore
+from synapse.api.errors import SynapseError, Codes
 from synapse.util.caches.descriptors import cachedInlineCallbacks
 
 import simplejson as json
@@ -24,6 +25,13 @@ import simplejson as json
 class FilteringStore(SQLBaseStore):
     @cachedInlineCallbacks(num_args=2)
     def get_user_filter(self, user_localpart, filter_id):
+        # filter_id is BIGINT UNSIGNED, so if it isn't a number, fail
+        # with a coherent error message rather than 500 M_UNKNOWN.
+        try:
+            int(filter_id)
+        except ValueError:
+            raise SynapseError(400, "Invalid filter ID", Codes.INVALID_PARAM)
+
         def_json = yield self._simple_select_one_onecol(
             table="user_filters",
             keyvalues={