Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSC3394: New auth rule that only allows someone to post a message in relation to another message #3394

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

frandavid100
Copy link

@frandavid100 frandavid100 commented Sep 12, 2021

@frandavid100 frandavid100 changed the title MSC: New auth rule that only allows someone to post a message in relation to another message MSC3394: New auth rule that only allows someone to post a message in relation to another message Sep 12, 2021
@@ -0,0 +1,19 @@
# Example: new auth rule that only allows someone to post a message in relation to another message
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# Example: new auth rule that only allows someone to post a message in relation to another message
# New auth rule that only allows someone to post a message in relation to another message


Matrix rooms can be used to a similar effect, if permissions are set so that regular users can't post any messages. Subscribers are fine with this most of the time, because they're usually more interested in reading new content by the room's owner than in replying to that content, or in reading what other subscribers have to say.

But some times they may want to give feedback, or read other people's opinions; and that can't be done today because, by definition, this kind of room prevents any type of conversation.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
But some times they may want to give feedback, or read other people's opinions; and that can't be done today because, by definition, this kind of room prevents any type of conversation.
But sometimes they may want to give feedback, or read other people's opinions; and that can't be done today because, by definition, this kind of room prevents any type of conversation.

@SimonBrandner
Copy link
Contributor

SimonBrandner commented Sep 12, 2021

Also, please wrap your lines after ~120 characters

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>

@FSG-Cat
Copy link
Contributor

FSG-Cat commented Sep 12, 2021

This will 100% need sign off so il just point that out.

@anoadragon453 anoadragon453 added client-server Client-Server API kind:feature MSC for not-core and not-maintenance stuff needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. proposal A matrix spec change proposal proposal-in-review s2s Server-to-Server API (federation) labels Sep 13, 2021
@uhoreg
Copy link
Member

uhoreg commented Sep 14, 2021

MSCs need to spell out the details for how they will achieve their goals. e.g. in this case, what property is used in what state event to indicate who is allowed to post replies, how you determine what's top-level vs. a reply, etc. I'm going to mark this as a draft for now.

@uhoreg uhoreg marked this pull request as draft September 14, 2021 20:19
@lboklin
Copy link

lboklin commented Oct 23, 2021

Related (re: threads-as-rooms): element-hq/element-web#2349 (comment)

@turt2live turt2live added requires-room-version An idea which will require a bump in room version unassigned-room-version Remove this label when things get versioned. labels Jan 2, 2022
…in-relation-to-another-message.md to 3394-new-auth-rule-that-only-allows-someone-to-post-a-message-in-relation-to-another-message.md

Today, chat platforms are used broadly in order to broadcast information to large audiences. An example of this are [Telegram channels](https://telegram.org/tour/channels/).

Matrix rooms can be used to a similar effect, if permissions are set so that regular users can't post any messages. Subscribers are fine with this most of the time, because they're usually more interested in reading new content by the room's owner than in replying to that content, or in reading what other subscribers have to say.
Copy link
Member

Choose a reason for hiding this comment

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

please could you wrap your lines at about 80 characters, to make it easier to read and comment on them?

Copy link
Author

Choose a reason for hiding this comment

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

Sure, I'll do that as soon as I get home.

Copy link
Author

Choose a reason for hiding this comment

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

OK, done. Is that better?

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

I'm afraid I can't commit to supporting you on this quest, but I think you'll need to be more explicit about what you're proposing here.


I propose a new auth rule that only allows room members to post a message if it's in relation to another message.

This will mean that regular users can't post top-level messages, but they can start threads and reply to them; this will allow for conversation inside the room while keeping the room clean for subscribers who just want the news; because the main timeline will only contain posts by the room's owner, and all the conversations will take place within threads.
Copy link
Member

Choose a reason for hiding this comment

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

please could you spell this out more precisely? What exactly does "starting a thread" mean here?

Compare with the existing auth rules (https://spec.matrix.org/latest/rooms/v7/#authorization-rules), which are very explicit.

Copy link
Author

Choose a reason for hiding this comment

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

Sorry, I'm quite new to this. I assume this is the rule that decides if a user can send a message to the room?

"If the event type’s required power level is greater than the sender’s power level, reject."

Copy link
Author

Choose a reason for hiding this comment

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

Hi, Rich. I just added the following to the MSC:

Based on existing auth rules, the new auth rule I'm proposing could probably look like this:

If type is m.room.message:
If the user's power level is higher than the power level for m.room.message events, allow.
Otherwise, check the new power level I want to introduce. If it's is higher than the user's power level, reject.
Otherwise, if the event doesn't have a relation, reject.
Otherwise, allow.

As an example, let's say I want to set up my room so that only moderators can post top-level messages, but regular users can comment those messages inside a thread. I will set a power level of 50 for the "send messages" permission, and a power level of 0 for the new "send messages to threads" permission.

When a user tries to send a message:

If they are a moderator (PL of 50) they are allowed.
Otherwise, if they are a regular user (PL of 0) and the message is inside a thread (it has a relation) they are allowed.
Otherwise, they're not allowed.

I would like some feedback on it, and maybe a couple suggestions if you think it needs further improvements.

Copy link
Member

Choose a reason for hiding this comment

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

As I said: sorry, I'm not able to devote any time to supporting you here, but I wish you luck! ❤️

Copy link
Author

Choose a reason for hiding this comment

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

Thanks anyway for pointing me in the right direction.


It may also be useful for additional purposes: for example a [client focused on social networking](https://matrix.org/blog/2020/12/18/introducing-cerulean) could use a room to store a user's posts, which could then be followed by other users; or a [matrix-based comment system](https://cactus.chat/) could show every post on a webpage in the same room, with all the discussions happening inside threads.

## Alternatives
Copy link
Member

Choose a reason for hiding this comment

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

Changing the auth rules is a complex process (notably, it requires a new room version). Have you considered a softer solution whereby messages are blocked at the C-S API rather than at the room DAG level? (So it would still be possible for users to send messages via a non-compliant server, but you might be able to handle that with other moderator controls)

Copy link
Author

Choose a reason for hiding this comment

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

I hadn't considered that option, and I have to admit that my knowledge of the spec is so shallow that it's hard for me to grasp the implications of using an approach instead of the other. Would there be any important advantages, besides not having to wait until a new room version is introduced?

Copy link
Member

Choose a reason for hiding this comment

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

I believe the only advantage would be not having to wait for a new room version and requiring rooms to be upgraded to it - but it's a fairly substantial one.

The downside is, as said, users could still post top-level messages. It's just that most users' homeservers would prevent them from doing so.

Copy link
Author

Choose a reason for hiding this comment

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

I don't think I know enough to adequately evaluate this alternative, but "users could still post top-level messages" sounds like an important drawback to me.

Copy link
Member

@anoadragon453 anoadragon453 left a comment

Choose a reason for hiding this comment

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

As mentioned, other messengers have the feature of allowing users to only post replies in threads, and I personally believe it would be nice to allow in Matrix.

As stated elsewhere though, this proposal needs some more technical details before it's ready,

@@ -0,0 +1,56 @@
# MSC3394: new auth rule that only allows someone to post a message in relation to another message
Copy link
Member

Choose a reason for hiding this comment

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

I think before this can go back into review, you'll need to pick a (threading) MSC to build on top of, then update the proposed event auth changes with the exact details related to that MSC.

At the moment, the proposal contains phrases such as "top-level messages" and "inside a thread", but what these mean exactly need to be defined. For example, if you picked MSC3440, you could say that "a message inside a thread is defined as an m.room.message event containing an m.relates_to field with a relation type of m.thread.

Once that's all done, feel free to mark it ready for review. Otherwise it likely won't get another review until this PR comes out of draft state.

Copy link
Author

@frandavid100 frandavid100 Feb 1, 2022

Choose a reason for hiding this comment

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

Hi, I added the following text to the proposal:

In the context of this proposal, and based on MSC3440, a "message inside a thread" is defined as an m.room.message event containing an m.relates_to field with a relation type of m.thread and a "top-level message" is defined as an m.room.message event NOT containing such a field.

Is that enough? Thanks for your help.

Copy link
Member

Choose a reason for hiding this comment

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

That's a great start! I would also define a name for your new m.room.power_levels field, rather than referring to it in the abstract. And note that once you do, you'll need to come up with an unstable prefixed version of it that unstable implementations can use before this MSC is merged.

See here for an example.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks again, Andrew.

What are the names of existing m.room.power_levels fields? Maybe if I could see some of them, I could define a proper name for the new one.

As for the unstable prefixed version, I have to admit that I know just enough to get the gist of that MSC after a couple reads, but not enough to use it as a model. This is a bit embarrasing, but I would need some more help.

@frandavid100 frandavid100 marked this pull request as ready for review February 1, 2022 20:56
Comment on lines 59 to 61
but not others) but it would also probably be more expensive.MSC3393: new auth rule that
only allows someone to post a message in relation to another messageMSC3393: new auth rule
that only allows someone to post a message in relation to another message.
Copy link
Member

Choose a reason for hiding this comment

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

I would also clean up these duplicated lines here.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks, I have no idea how those got in there :-(


It may also be useful for additional purposes: for example a [client focused on social networking](https://matrix.org/blog/2020/12/18/introducing-cerulean) could use a room to store a user's posts, which could then be followed by other users; or a [matrix-based comment system](https://cactus.chat/) could show every post on a webpage in the same room, with all the discussions happening inside threads.

## Alternatives
Copy link
Member

Choose a reason for hiding this comment

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

I believe the only advantage would be not having to wait for a new room version and requiring rooms to be upgraded to it - but it's a fairly substantial one.

The downside is, as said, users could still post top-level messages. It's just that most users' homeservers would prevent them from doing so.


1. If type is m.room.message:
1. If the user's power level is higher than the power level for m.room.message events, allow.
2. Otherwise, check the new power level I want to introduce. If it's is higher than the user's power level, reject.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
2. Otherwise, check the new power level I want to introduce. If it's is higher than the user's power level, reject.
2. Otherwise, check the new power level I want to introduce. If it is higher than the user's power level, reject.

@@ -0,0 +1,56 @@
# MSC3394: new auth rule that only allows someone to post a message in relation to another message
Copy link
Member

Choose a reason for hiding this comment

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

That's a great start! I would also define a name for your new m.room.power_levels field, rather than referring to it in the abstract. And note that once you do, you'll need to come up with an unstable prefixed version of it that unstable implementations can use before this MSC is merged.

See here for an example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client-server Client-Server API kind:feature MSC for not-core and not-maintenance stuff needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. proposal A matrix spec change proposal requires-room-version An idea which will require a bump in room version s2s Server-to-Server API (federation) unassigned-room-version Remove this label when things get versioned.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants