summary refs log tree commit diff
diff options
context:
space:
mode:
authorOlivier Wilkinson (reivilibre) <oliverw@matrix.org>2021-12-09 13:10:18 +0000
committerOlivier Wilkinson (reivilibre) <oliverw@matrix.org>2021-12-09 13:10:18 +0000
commitae968eaa936513455b77768c92dd22ef0bf847a7 (patch)
tree7f00dbb7b70bd1865201c50f016e93e0f5ed59da
parentAdd a pair of tests for the ?device_id parameter for AS device masquerading (diff)
downloadsynapse-ae968eaa936513455b77768c92dd22ef0bf847a7.tar.xz
Add an experimental flag to control device masquerading
-rw-r--r--synapse/api/auth.py5
-rw-r--r--synapse/config/experimental.py5
2 files changed, 9 insertions, 1 deletions
diff --git a/synapse/api/auth.py b/synapse/api/auth.py
index fd48735e1c..0bb4b77f84 100644
--- a/synapse/api/auth.py
+++ b/synapse/api/auth.py
@@ -339,7 +339,10 @@ class Auth:
 
         effective_device_id: Optional[str] = None
 
-        if DEVICE_ID_ARG_NAME in request.args:
+        if (
+            self.hs.config.experimental.msc3202_device_masquerading_enabled
+            and DEVICE_ID_ARG_NAME in request.args
+        ):
             effective_device_id = request.args[DEVICE_ID_ARG_NAME][0].decode("utf8")
             # We only just set this so it can't be None!
             assert effective_device_id is not None
diff --git a/synapse/config/experimental.py b/synapse/config/experimental.py
index d78a15097c..678c78d565 100644
--- a/synapse/config/experimental.py
+++ b/synapse/config/experimental.py
@@ -49,3 +49,8 @@ class ExperimentalConfig(Config):
 
         # MSC3030 (Jump to date API endpoint)
         self.msc3030_enabled: bool = experimental.get("msc3030_enabled", False)
+
+        # The portion of MSC3202 which is related to device masquerading.
+        self.msc3202_device_masquerading_enabled: bool = experimental.get(
+            "msc3202_device_masquerading", False
+        )