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

Add a config option to specify which homeservers can access Sydent #566

Merged
merged 8 commits into from
Jun 12, 2023

Conversation

H-Shay
Copy link
Contributor

@H-Shay H-Shay commented Jun 1, 2023

This PR adds a config option homeserver_allow_list which enables a user to specify a list of homeservers which Sydent will work with. The option defaults to allow all homeservers if not set. It works by disabling registration unless the homeserver associated with the registration request is in the homeserver_allow_list. The thinking behind this is that without registration an access token cannot be granted - and access tokens are necessary for most functions of Sydent. Fixes #565.

@H-Shay H-Shay requested a review from a team as a code owner June 1, 2023 22:29
@H-Shay H-Shay marked this pull request as draft June 1, 2023 23:26
@richvdh
Copy link
Member

richvdh commented Jun 2, 2023

Doesn't this rely on us turning off the v1 api (#338), which doesn't require an access token?

@erikjohnston erikjohnston removed the request for review from a team June 2, 2023 10:51
@erikjohnston
Copy link
Member

Doesn't this rely on us turning off the v1 api (#338), which doesn't require an access token?

There's already a config for turning that off, which I believe we can use in the use case where we're interested in restricting by HS. Though we might want to error if you enable this option without disabling v1?

@richvdh
Copy link
Member

richvdh commented Jun 2, 2023

Doesn't this rely on us turning off the v1 api (#338), which doesn't require an access token?

There's already a config for turning that off,

Ah, I didn't know about that. Might be good to link it from #338.

@H-Shay
Copy link
Contributor Author

H-Shay commented Jun 2, 2023

So the only config option I found referring to turning off the V1 API was this:

# Whether clients and homeservers can register an association using v1 endpoints.
"enable_v1_associations": "true",

but it only governs one endpoint it seems (albeit an important one):
if self.sydent.config.general.enable_v1_associations:
threepid_v1.putChild(b"bind", ThreePidBindServlet(sydent))

Is this Good Enough:tm: or should I add a config option to turn off the rest of the VI API endpoints?

@erikjohnston
Copy link
Member

Is this Good Enough or should I add a config option to turn off the rest of the VI API endpoints?

Oh, hmm. Yeah, we probably want to be able to disable all of it. Or maybe we can make specifying the homeserver config automagically disable API access if you're not authorized (i.e. disabling v1 API), but I'm not sure I like that.

@H-Shay H-Shay force-pushed the shay/limit_homeservers branch from 0fd6e6a to 994e528 Compare June 6, 2023 19:21
@H-Shay H-Shay marked this pull request as ready for review June 6, 2023 19:23
@H-Shay H-Shay requested a review from a team June 7, 2023 16:05
@H-Shay H-Shay self-assigned this Jun 8, 2023
sydent/config/__init__.py Outdated Show resolved Hide resolved
sydent/config/__init__.py Outdated Show resolved Hide resolved
sydent/http/httpserver.py Outdated Show resolved Hide resolved
@H-Shay H-Shay requested a review from erikjohnston June 12, 2023 16:17
@H-Shay H-Shay merged commit 3017c31 into main Jun 12, 2023
@H-Shay H-Shay deleted the shay/limit_homeservers branch June 12, 2023 17:02
@H-Shay
Copy link
Contributor Author

H-Shay commented Jun 12, 2023

Merged #566 into main.

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.

Allow restricting Sydent to use by a specific list of Homeservers
3 participants