summary refs log tree commit diff
path: root/synapse/rest/client/v2_alpha
diff options
context:
space:
mode:
authorMatthew Hodgson <matthew@matrix.org>2017-12-06 10:02:49 +0100
committerHubert Chathi <hubert@uhoreg.ca>2018-08-12 19:14:31 -0400
commit69e51c7ba48a84b48ab64c8c290a232d14193a18 (patch)
tree59d7a6647c398d63cb70611d11be45de93e2bcca /synapse/rest/client/v2_alpha
parentimplement /room_keys/version too (untested) (diff)
downloadsynapse-69e51c7ba48a84b48ab64c8c290a232d14193a18.tar.xz
make /room_keys/version work
Diffstat (limited to 'synapse/rest/client/v2_alpha')
-rw-r--r--synapse/rest/client/v2_alpha/room_keys.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/synapse/rest/client/v2_alpha/room_keys.py b/synapse/rest/client/v2_alpha/room_keys.py
index 4d76e1d824..128b732fb1 100644
--- a/synapse/rest/client/v2_alpha/room_keys.py
+++ b/synapse/rest/client/v2_alpha/room_keys.py
@@ -17,6 +17,7 @@ import logging
 
 from twisted.internet import defer
 
+from synapse.api.errors import SynapseError
 from synapse.http.servlet import (
     RestServlet, parse_json_object_from_request
 )
@@ -237,15 +238,21 @@ class RoomKeysVersionServlet(RestServlet):
 
     @defer.inlineCallbacks
     def on_POST(self, request, version):
+        if version:
+            raise SynapseError(405, "Cannot POST to a specific version")
+
         requester = yield self.auth.get_user_by_req(request, allow_guest=False)
         user_id = requester.user.to_string()
         info = parse_json_object_from_request(request)
 
         new_version = yield self.e2e_room_keys_handler.create_version(
-            user_id, version, info
+            user_id, info
         )
         defer.returnValue((200, {"version": new_version}))
 
+    # we deliberately don't have a PUT /version, as these things really should
+    # be immutable to avoid people footgunning
+
     @defer.inlineCallbacks
     def on_GET(self, request, version):
         requester = yield self.auth.get_user_by_req(request, allow_guest=False)