-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Warn, instead of erroring, if the client dict changes during UI Auth. #7483
Changes from 4 commits
55a271a
60273fc
2be3159
5da559c
b66aafa
5fc9804
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Restore compatibility with non-compliant clients during the user inteactive authentication process. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -133,47 +133,6 @@ def test_fallback_captcha(self): | |
| # We're given a registered user. | ||
| self.assertEqual(channel.json_body["user_id"], "@user:test") | ||
|
|
||
| def test_legacy_registration(self): | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test becomes redundant with the test modified below since registration is not special anymore. |
||
| """ | ||
| Registration allows the parameters to vary through the process. | ||
| """ | ||
|
|
||
| # Make the initial request to register. (Later on a different password | ||
| # will be used.) | ||
| # Returns a 401 as per the spec | ||
| channel = self.register( | ||
| 401, {"username": "user", "type": "m.login.password", "password": "bar"}, | ||
| ) | ||
|
|
||
| # Grab the session | ||
| session = channel.json_body["session"] | ||
| # Assert our configured public key is being given | ||
| self.assertEqual( | ||
| channel.json_body["params"]["m.login.recaptcha"]["public_key"], "brokencake" | ||
| ) | ||
|
|
||
| # Complete the recaptcha step. | ||
| self.recaptcha(session, 200) | ||
|
|
||
| # also complete the dummy auth | ||
| self.register(200, {"auth": {"session": session, "type": "m.login.dummy"}}) | ||
|
|
||
| # Now we should have fulfilled a complete auth flow, including | ||
| # the recaptcha fallback step. Make the initial request again, but | ||
| # with a changed password. This still completes. | ||
| channel = self.register( | ||
| 200, | ||
| { | ||
| "username": "user", | ||
| "type": "m.login.password", | ||
| "password": "foo", # Note that this is different. | ||
| "auth": {"session": session}, | ||
| }, | ||
| ) | ||
|
|
||
| # We're given a registered user. | ||
| self.assertEqual(channel.json_body["user_id"], "@user:test") | ||
|
|
||
| def test_complete_operation_unknown_session(self): | ||
| """ | ||
| Attempting to mark an invalid session as complete should error. | ||
|
|
@@ -282,9 +241,11 @@ def test_ui_auth(self): | |
| }, | ||
| ) | ||
|
|
||
| def test_cannot_change_body(self): | ||
| def test_can_change_body(self): | ||
| """ | ||
| The initial requested client dict cannot be modified during the user interactive authentication session. | ||
| The client dict can be modified during the user interactive authentication session. | ||
|
|
||
| Note that this is not spec compliant, but is necessary for clients to work. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be worth putting in a "The test will be removed in the future" notice here too.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should not be removed in the future, it should be updated to show that this gets rejected. (Essentially backing out these changes).
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @anoadragon453 I updated this comment, hopefully it is clearer now! |
||
| """ | ||
| # Create a second login. | ||
| self.login("test", self.user_pass) | ||
|
|
@@ -302,9 +263,9 @@ def test_cannot_change_body(self): | |
| self.assertIn({"stages": ["m.login.password"]}, channel.json_body["flows"]) | ||
|
|
||
| # Make another request providing the UI auth flow, but try to delete the | ||
| # second device. This results in an error. | ||
| # second device. | ||
| self.delete_devices( | ||
| 403, | ||
| 200, | ||
| { | ||
| "devices": [device_ids[1]], | ||
| "auth": { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.