Skip to content

Invite registrations - #6024

Open
devonh wants to merge 2 commits into
devonh/invite-linksfrom
devonh/invite-registrations
Open

devonh wants to merge 2 commits into
devonh/invite-linksfrom
devonh/invite-registrations

Conversation

@devonh

@devonh devonh commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

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

Reviewable commit by commit.

This PR adds UserRegistrationToken::is_invite() as the one definition of an invite registration: valid registration token, passwordless, and pins both username and email address.

Also changed in this PR:

  • No upstream providers on the registration form for an invite registration
    • An external invitee could otherwise pick the company's single sign-on by mistake, which would also drop the invite
    • The "Sign in" link stays, and the sign-in page keeps its own providers, for an invitee who already has an account
  • rate_limiting.registration is bypassed
    • That limit is keyed on the client IP, three an hour by default, so a team invited together from behind one NAT could only accept three invites an hour. An invite registers only the one username it pins, and only an admin client can mint one, so it can't be used to register in bulk. The email authentication rate limits still apply.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Deploying matrix-authentication-service-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: e4e9e3f
Status: ✅  Deploy successful!
Preview URL: https://a02e0ae8.matrix-authentication-service-docs.pages.dev
Branch Preview URL: https://devonh-invite-registrations.matrix-authentication-service-docs.pages.dev

View logs

@devonh devonh changed the title Devonh/invite registrations Invite registrations Oct 5, 2026
@devonh
devonh added this pull request to stack #6027 October 5, 2026 20:48
@devonh
devonh force-pushed the devonh/invite-registrations branch from 571b420 to 1ec1bae Compare October 9, 2026 20:10
/// Returns `true` if the token is an invite: it registers without a
/// password, as the username and the email address it pins
#[must_use]
pub fn is_invite(&self) -> bool {

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.

Should this be renamed to is_guest_invite to distinguish it better?
Would this ever be used for non-guests?

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.

I think I like is_guest_invite better
Think it fits the 'passwordless' aspect especially?

Comment on lines +376 to +382
/// The invite code the registration form was submitted with
pub(super) enum InviteCode<'a> {
Missing,
Invalid,
Valid(&'a UserRegistrationToken),
}

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.

This is a small refactoring to allow accessing the registration_token.

@devonh
devonh marked this pull request as ready for review October 11, 2026 03:23
@devonh
devonh requested a review from a team as a code owner October 11, 2026 03:23
@devonh
devonh requested review from reivilibre and removed request for a team October 11, 2026 03:23
/// Returns `true` if the token is an invite: it registers without a
/// password, as the username and the email address it pins
#[must_use]
pub fn is_invite(&self) -> bool {

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.

I think I like is_guest_invite better
Think it fits the 'passwordless' aspect especially?

let is_invite = registration_token
.as_ref()
.is_some_and(UserRegistrationToken::is_invite);
if !is_invite && let Err(e) = limiter.check_registration(requester) {

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.

(do we need some generous but finite rate limiting to avoid bruteforcing invite tokens?)

@sandhose
sandhose force-pushed the devonh/invite-registrations branch from 7b09f0d to 9d161bc Compare October 13, 2026 09:32
@sandhose
sandhose removed this pull request from stack #6027 October 13, 2026 09:32
@sandhose
sandhose added this pull request to stack #6046 October 13, 2026 09:32
@sandhose
sandhose force-pushed the devonh/invite-registrations branch from 9d161bc to fdc52ff Compare October 13, 2026 12:02
@sandhose
sandhose removed this pull request from stack #6046 October 13, 2026 12:02
@sandhose
sandhose added this pull request to stack #6047 October 13, 2026 12:02
@sandhose
sandhose force-pushed the devonh/invite-registrations branch from fdc52ff to 059bc0b Compare October 13, 2026 13:35
@devonh
devonh removed this pull request from stack #6047 October 14, 2026 22:01
@devonh
devonh added this pull request to stack #6052 October 14, 2026 22:01
@sandhose
sandhose force-pushed the devonh/invite-registrations branch 2 times, most recently from e003592 to f613d7b Compare October 16, 2026 09:34
devonh and others added 2 commits October 16, 2026 14:58
A registration token which is passwordless and pins both a username and
an email address is an invite for one person. Its registration form
offered the upstream providers too, so an external invitee could pick
the company's single sign-on by mistake. The form now offers none for
an invite. The sign-in link stays, and the sign-in page keeps its own
providers, for an invitee who already has an account.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CZdGaj9bJcn5QeeUw8YXoF
The registration rate limit is keyed on the client IP only, three per
hour by default, so a team invited together from behind one NAT could
only accept three invites an hour. An invite registers only the one
username it pins, and is minted by an admin client for one address, so
it can't be used to register in bulk. The email authentication rate
limits still apply to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CZdGaj9bJcn5QeeUw8YXoF
@sandhose
sandhose force-pushed the devonh/invite-registrations branch from f613d7b to e4e9e3f Compare October 16, 2026 12:58

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.

2 participants