FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Make restricted room join tests clearer by morguldir · Pull Request #752 · matrix-org/complement · GitHub

Repository navigation

Make restricted room join tests clearer - #752

Open
morguldir wants to merge 3 commits into
matrix-org:mainfrom
morguldir:more-mustard
Open

morguldir wants to merge 3 commits into
matrix-org:mainfrom
morguldir:more-mustard

Conversation

Copy link
Copy Markdown

Firstly this PR makes the tests work on more implementations, for example ruma and GMS won't really understand join_authorised_via_users_server not looking like a user id, similar to what #224 tried to do

Making it a user id that isn't correct still makes sure that the server can handle clients updating the member event directly with /myroomnick or similar

Some errors were also silently being ignored, which made it harder to tell which part of the test was actually failing

Pull Request Checklist

x86pup and others added 3 commits December 9, 2024 13:02
…o strict ruma parsing requirements

Signed-off-by: strawberry <strawberry@puppygock.gay>
Signed-off-by: strawberry <strawberry@puppygock.gay>
Signed-off-by: morguldir <morguldir@protonmail.com>
morguldir requested review from a team as code owners December 31, 2024 06:52
// This should be ignored since this is a join -> join transition.
"join_authorised_via_users_server": "unused",
// This should be ignored by the server since this is a join -> join transition
"join_authorised_via_users_server": "@unused:unused.local",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

What happens if a ruma-based server gets garbage here then? Does it still work?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

It can create the event then, but it won’t really work properly unless the server removes the field when handling the PUT like synapse does

So when verifying the signature of a federation event actually looking like that it won’t work still

This part i think is intended though, although seemingly synapse changed that behaviour at some point too 🧐

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'm not really following your comment, sorry. Shouldn't the field be removed no matter what? So what isn't working for ruma?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Sorry yeah it should, but if another server forgets to remove it, then ruma still tries to check the signature, but synapse seems to still allow the event

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Irrespective of the behaviour of Synapse and Ruma, this field should either be set to a valid structure for this field (a Matrix ID), or it should explicitly call out that this field is set to an invalid value on purpose.

As the latter does not appear the case, I agree with this change. However I'm not opposed to another test that checks homeservers correctly handle invalid content in this field.


return ev.Get("content").Get("membership").Str == "leave"
}))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This is a duplicate of the stuff underneath? Why add this?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

It makes sure the leave worked in both rooms now

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Wouldn't this break if a single sync contained both leaves?

MustSyncUntil supports multiple SyncCheckOpt instances, so you can provide two functions that verify that bob has left the rooms in question.

You can also replace SyncTimelineHas with SyncLeftFrom to save yourself the manual event content checking.

anoadragon453 left a comment •
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Minor request, otherwise LGTM!

Edit: also could you please fix the git conflict.


return ev.Get("content").Get("membership").Str == "leave"
}))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Wouldn't this break if a single sync contained both leaves?

MustSyncUntil supports multiple SyncCheckOpt instances, so you can provide two functions that verify that bob has left the rooms in question.

You can also replace SyncTimelineHas with SyncLeftFrom to save yourself the manual event content checking.

// This should be ignored since this is a join -> join transition.
"join_authorised_via_users_server": "unused",
// This should be ignored by the server since this is a join -> join transition
"join_authorised_via_users_server": "@unused:unused.local",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Irrespective of the behaviour of Synapse and Ruma, this field should either be set to a valid structure for this field (a Matrix ID), or it should explicitly call out that this field is set to an invalid value on purpose.

As the latter does not appear the case, I agree with this change. However I'm not opposed to another test that checks homeservers correctly handle invalid content in this field.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL