Skip to content

Commit 690b3a4

Browse files
authored
Allow using MSC4190 features without opt-in (#19031)
1 parent d399d76 commit 690b3a4

File tree

4 files changed

+6
-19
lines changed

4 files changed

+6
-19
lines changed

changelog.d/19031.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Allow using [MSC4190](https://github.com/matrix-org/matrix-spec-proposals/pull/4190) behavior without the opt-in registration flag. Contributed by @tulir @ Beeper.

synapse/rest/client/devices.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ async def on_POST(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
112112
else:
113113
raise e
114114

115-
if requester.app_service and requester.app_service.msc4190_device_management:
115+
if requester.app_service:
116116
# MSC4190 can skip UIA for this endpoint
117117
pass
118118
else:
@@ -192,7 +192,7 @@ async def on_DELETE(
192192
else:
193193
raise
194194

195-
if requester.app_service and requester.app_service.msc4190_device_management:
195+
if requester.app_service:
196196
# MSC4190 allows appservices to delete devices through this endpoint without UIA
197197
# It's also allowed with MSC3861 enabled
198198
pass
@@ -227,7 +227,7 @@ async def on_PUT(
227227
body = parse_and_validate_json_object_from_request(request, self.PutBody)
228228

229229
# MSC4190 allows appservices to create devices through this endpoint
230-
if requester.app_service and requester.app_service.msc4190_device_management:
230+
if requester.app_service:
231231
created = await self.device_handler.upsert_device(
232232
user_id=requester.user.to_string(),
233233
device_id=device_id,

synapse/rest/client/keys.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -543,15 +543,11 @@ async def on_POST(self, request: SynapseRequest) -> Tuple[int, JsonDict]:
543543
if not keys_are_different:
544544
return 200, {}
545545

546-
# MSC4190 can skip UIA for replacing cross-signing keys as well.
547-
is_appservice_with_msc4190 = (
548-
requester.app_service and requester.app_service.msc4190_device_management
549-
)
550-
551546
# The keys are different; is x-signing set up? If no, then this is first-time
552547
# setup, and that is allowed without UIA, per MSC3967.
553548
# If yes, then we need to authenticate the change.
554-
if is_cross_signing_setup and not is_appservice_with_msc4190:
549+
# MSC4190 can skip UIA for replacing cross-signing keys as well.
550+
if is_cross_signing_setup and not requester.app_service:
555551
# With MSC3861, UIA is not possible. Instead, the auth service has to
556552
# explicitly mark the master key as replaceable.
557553
if self.hs.config.mas.enabled:

tests/rest/client/test_devices.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -533,16 +533,6 @@ def test_PUT_device(self) -> None:
533533
)
534534
self.assertEqual(channel.code, 200, channel.json_body)
535535

536-
# On the regular service, that API should not allow for the
537-
# creation of new devices.
538-
channel = self.make_request(
539-
"PUT",
540-
"/_matrix/client/v3/devices/AABBCCDD?user_id=@bob:test",
541-
content={"display_name": "Bob's device"},
542-
access_token=self.pre_msc_service.token,
543-
)
544-
self.assertEqual(channel.code, 404, channel.json_body)
545-
546536
def test_DELETE_device(self) -> None:
547537
self.register_appservice_user(
548538
"alice", self.msc4190_service.token, inhibit_login=True

0 commit comments

Comments
 (0)