8000 Set default federate by settings by psaavedra · Pull Request #2199 · matrix-org/synapse · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Set default federate by settings #2199

Closed

Conversation

psaavedra
Copy link
Contributor
@psaavedra psaavedra commented May 8, 2017

This change allows change the default value for m.federate value during the create action. Useful for enviroments where you prefer m.federate = False as default choice for the created rooms.

In addition, the patch manage the situation of 1-to-1 rooms creation where the other peer is from a external domain. In this case, the room is created as m.federate=True in order to avoid break the interaction with external servers.

This PR is embraces the following SPEC: https://docs.google.com/document/d/14zqsbwl5KKil-bB8w2HMhidBVmFkP9Q7EQKFwKIIfZc/edit#heading=h.eipip5qhqo0d

Other PR in matrix-react-sdk and matrix-js-sdk and riot-web are envolved

Related PR:

Signed-off-by: Pablo Saavedra psaavedra@igalia.com

@matrixbot
Copy link
Member

Can one of the admins verify this patch?

2 similar comments
@matrixbot
Copy link
Member

Can one of the admins verify this patch?

@matrixbot
Copy link
Member

Can one of the admins verify this patch?

@erikjohnston
Copy link
Member

@matrixbot ok to test

@erikjohnston
Copy link
Member

I don't think this should be touching anything in synapse/api/auth.py or synapse/event_auth.py? Setting the m.federate flag in the creation event should be enough?

@psaavedra
Copy link
Contributor Author

Unfortunattely, I think is required for this reasons:

  • to still work with previously created events in the past (note that this action could lacks of m.federate information from the body).
  • A redacted event generates a default content which also lacks about m.federate information. In the code, this results that on R191 (https://github.com/matrix-org/synapse/pull/2199/files#diff-a9f594f3677833c150b6c2c8a40b39f7R191) you could receive a event with no m.federate information. And in this part of the trace, you have not enough information to choice about waht to do if the default behaviour is not passed as argument.

@psaavedra
Copy link
Contributor Author

TODO: check the coding style

@psaavedra psaavedra force-pushed the set_default_federate_by_settings branch from 25f41c9 to 3b01abb Compare August 4, 2017 08:30
@psaavedra
Copy link
Contributor Author

I wonder if there is any change to promote this change into the master stream. Tahnks in advance.

@ara4n
Copy link
Member
ara4n commented Aug 17, 2017

@erikjohnston can you take a look again when you're back from hol please?

@andrewgdunn
Copy link

I appreciate this PRs existence. We were just "hit" by a @hscrawler:matrix.org which has a display name of mole, and is apparently listing the directory from each homeserver, then joining the room.

A couple things about initial assumptions I had as a homeserver operator:

  • the "directory" to me was within the context of my homeserver, not a list of rooms that I wanted to have publicized via some api endpoint (shame on me I guess for not reading through the API better)
  • federation seemed like an event that would only occur if we invited someone from another homeserver to a room on ours, otherwise the expectation was that the room would stay on the homeserver.

This @hscrawler:matrix.org is not necessarily abusing the matrix ecosystem, however it shows that its fairly easy for someone to write a bot, find all "public" rooms (which many homeserver operators probably don't think are public), join those rooms, and pull history.

I think there is a strong case for many homeserver operators to have m.federate default to false, and only be ratcheted on when some event required federation. You might say "why not turn off federation entirely", well then you'd loose the ability to join things like matrix-hq, irc-bridges, push notifications, etc.

Please @ara4n bring this up with the team about their initial assumptions for homeserver operation. I cannot believe my assumptions we're unique to just me. From what you stated, @hscrawler:matrix.org has already poked into over 1700 homeservers. I'm guessing some of those folks are unhappy about the 'mole' peeking into their space.

erikjohnston and others added 2 commits November 15, 2017 15:41
* Added room_federate_default setting
* Added room_federate_default parameter
* The default m.federate value of the rooms can be modified in the
  config file
* Default behavior of _can_federate is set with room_federate_default
  * self.hs.config.room_federate_default is passed as arg in Auth.check()
  * check function signature modified: receives room_federate_default
  * _can_federate function signature modified: receives
    room_federate_default
* is_membership_change_allowed function signature modified: receives
  room_federate_default
* room_federate_default only applies for events from the local hostname.
  Server only uses the room_federate_default value for events from the
  local server. This is a backguard compatibility check.
* Federate is True for Direct Chat with external users
@psaavedra psaavedra force-pushed the set_default_federate_by_settings branch from 3b01abb to 4a5b773 Compare November 15, 2017 14:55
@richvdh
Copy link
Member
richvdh commented Apr 10, 2018

I'm sorry this has been left to bitrot; however it's now quite out of date and the other PRs mentioned in the description no longer seem relevant. I'm going to close it for now but if you'd like to bring it up to date that would be great!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0