Skip to content

Apply Synapse's invite controls to guest invites - #306

Draft
devonh wants to merge 6 commits into
devonh/room-invite-guestsfrom
devonh/guest-invite-synapse-controls
Draft

devonh wants to merge 6 commits into
devonh/room-invite-guestsfrom
devonh/guest-invite-synapse-controls

Conversation

@devonh

@devonh devonh commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Part of https://github.com/element-hq/backend-internal/issues/292

Applies Synapse's own email-invite controls to POST /_synapse/client/invite_guests (#304):

  • block_non_admin_invites: when enabled, a non-admin caller is refused (403).
  • A third-party rules module's check_threepid_can_be_invited and a spam checker's user_may_send_3pid_invite run for each address. If either refuses any address, the request is refused (403).

Like every other refusal, these come before the per-inviter limit, so a refused request doesn't spend it.

This may or may not be desirable for the guest invites module, so I have split it off as it's own PR for us to deliberate on.

An operator who blocks invites from non-admins, or refuses addresses
through a third-party rules or spam checker module, expects that to
cover every invite their server emails, as it does Synapse's own email
invites.

The admin check comes before the room checks, as Synapse makes it
before its own. The address checks, like every refusal here, come
before the limit, so a refused request doesn't spend it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CZdGaj9bJcn5QeeUw8YXoF
@devonh
devonh added this pull request to stack #307 October 5, 2026 21:25
@devonh

devonh commented Oct 10, 2026

Copy link
Copy Markdown
Member Author

CI failing is due to a failure on main.
#308 fixes the issue.

@@ -16,6 +16,7 @@
from synapse.event_auth import get_named_level, get_user_power_level
from synapse.http.site import SynapseRequest

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@sandhose Do we want these additional checks on the new guest email invites?
Synapse has these config options which would seem applicable to the module.
But I can also understand if we don't want to tie the different config options together.

I split this off as a separate PR so we can both decide on it as it's own thing and for it to be easily rolled back if we happen to merge it, then later decide we want to take it out.

Let me know what you think.

devonh and others added 3 commits October 13, 2026 19:07
…apse-controls

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RkxQWj8RAKd7iZ1JQtXdxm
…apse-controls

# Conflicts:
#	modules/restricted-guests/synapse/README.md
…apse-controls

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0145EoXnCPYo2bnhuGTohX55

This branch has not been deployed

No deployments
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.

1 participant