@@ -252,7 +252,6 @@ async def check_auth(
252252 clientdict : Dict [str , Any ],
253253 clientip : str ,
254254 description : str ,
255- validate_clientdict : bool = True ,
256255 ) -> Tuple [dict , dict , str ]:
257256 """
258257 Takes a dictionary sent by the client in the login / registration
@@ -278,10 +277,6 @@ async def check_auth(
278277 description: A human readable string to be displayed to the user that
279278 describes the operation happening on their account.
280279
281- validate_clientdict: Whether to validate that the operation happening
282- on the account has not changed. If this is false,
283- the client dict is persisted instead of validated.
284-
285280 Returns:
286281 A tuple of (creds, params, session_id).
287282
@@ -346,26 +341,30 @@ async def check_auth(
346341
347342 # Ensure that the queried operation does not vary between stages of
348343 # the UI authentication session. This is done by generating a stable
349- # comparator based on the URI, method, and client dict (minus the
350- # auth dict) and storing it during the initial query. Subsequent
344+ # comparator and storing it during the initial query. Subsequent
351345 # queries ensure that this comparator has not changed.
352- if validate_clientdict :
353- session_comparator = (session .uri , session .method , session .clientdict )
354- comparator = (uri , method , clientdict )
355- else :
356- session_comparator = (session .uri , session .method ) # type: ignore
357- comparator = (uri , method ) # type: ignore
358-
359- if session_comparator != comparator :
346+ #
347+ # The comparator is based on the requested URI and HTTP method. The
348+ # client dict (minus the auth dict) should also be checked, but some
349+ # clients are not spec compliant, just warn for now if the client
350+ # dict changes.
351+ if (session .uri , session .method ) != (uri , method ):
360352 raise SynapseError (
361353 403 ,
362354 "Requested operation has changed during the UI authentication session." ,
363355 )
364356
365- # For backwards compatibility the registration endpoint persists
366- # changes to the client dict instead of validating them.
367- if not validate_clientdict :
368- await self .store .set_ui_auth_clientdict (sid , clientdict )
357+ if session .clientdict != clientdict :
358+ logger .warning (
359+ "Requested operation has changed during the UI "
360+ "authentication session. A future version of Synapse "
361+ "will remove this capability."
362+ )
363+
364+ # For backwards compatibility, changes to the client dict are
365+ # persisted as clients modify them throughout their user interactive
366+ # authentication flow.
367+ await self .store .set_ui_auth_clientdict (sid , clientdict )
369368
370369 if not authdict :
371370 raise InteractiveAuthIncompleteError (
0 commit comments