Commit Graph
564 Commits
Author SHA1 Message Date
Devon Hudson 04530732ef Merge branch 'devonh/token-allowed-emails' into quenting/guest-invite-link-design 2026-11-13 21:19:48 +00:00
Devon Hudson c6214ae6bd Merge branch 'devonh/invite-guests' into devonh/token-allowed-emails
# Conflicts:
#	crates/handlers/src/views/register/password.rs
2026-11-13 21:19:48 +00:00
Devon Hudson e93bfedf84 Merge branch 'devonh/open-room' into devonh/invite-guests 2026-11-13 21:16:46 +00:00
Devon Hudson 113496e2e0 Merge branch 'devonh/username-templates' into devonh/open-room
# Conflicts:
#	crates/handlers/src/views/register/mod.rs
2026-11-13 21:16:46 +00:00
Devon Hudson fa80e3a4cb Merge branch 'devonh/register-invite-links' into devonh/username-templates 2026-11-13 21:14:05 +00:00
Devon HudsonandClaude Opus 5.5 c6d1eb10d3 Warn that a custom registration token must be hard to guess
Its invite URL shows whoever holds it the username and email address the token imposes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqDpJcPorK3QoHp6G6hsYt
2026-11-13 21:10:23 +00:00
Devon HudsonandClaude Opus 5.5 5e30e40f75 Name the registration without an email by what it does
A token that is passwordless, has a username template and has no email
address pinned or allowed registers with only a display name. That
condition was called an invite link, though every token has an invite
link (`invite_url`), and a link listing the addresses allowed to use it
didn't count as one. It is now `registers_without_email()`, and
`without_email` on the registration page.

The page's other names drop the guest and link wording for what MAS
checks: `passwordless` for any valid passwordless token, with the
heading strings and the login link's prop named the same way. What the
page says is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqDpJcZUXYbZ74Y9v5jZ7y
2026-11-10 20:16:36 +00:00
Devon HudsonandClaude Opus 5.5 abae562e3c Hold registrations to a token's allowed email addresses
With a token listing the addresses it allows, `POST /register` refuses
any other with an error on the email field, before a code is sent, and
the island explains it without naming the listed addresses.

One check on the token covers a pinned address and a list, in
`POST /register`, the token step and the last checks when finishing.
The last two read the token as it stands then, so a list replaced while
a registration is under way applies to it. `invite-emails` sends a
listed token only to an address on its list.

A passwordless token with a list skips the registration rate limit, as
one with a pinned email does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqDpJaaUkGGq5GiEbU9G3f
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqDpJYpWHZUTqexCFxqUAq
2026-11-10 01:01:46 +00:00
fc8b57db45 HACK: guest invite links without an email, display name on the first step
Design alignment for the Guest-XP Figma, not for merge.

An invite link (passwordless token, username template, no pinned email)
registers a guest with a display name and no email: the first step asks
for the display name, finish skips the email code and the display-name
step. It names no address, so it stays under the per-IP registration
rate limit. Email invites only get the new heading, subtitle and icon.

A token listing the addresses allowed to use it isn't an invite link, so
the people it invites type and verify one of those addresses, and none
of them registers without one.

Co-Authored-By: Devon Hudson <devon.dmytro@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqDpJaaUkGGq5GiEbU9G3f
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqDpJYpWHZUTqexCFxqUAq
2026-11-10 01:01:46 +00:00
Devon HudsonandClaude b75883927f Add POST /api/admin/v1/user-registration-tokens/invite-emails
The endpoint emails the invite links of registration tokens minted
through the token API: to the token's own address, or to one given for
a token without an address. The links are only ever mailed, so the
response carries a count rather than the links.

Everything is checked before anything is scheduled, so a rejected
request sends no email at all: each token must exist and be valid, and
an address given for a token with one must be the token's, ignoring
case. A token and address given more than once, ignoring case, are
emailed once. The sends are spread 100 ms apart, so a large batch
doesn't burst against the SMTP server.

The caller sends the room name and the inviter on the inviter's behalf,
so the endpoint doesn't trust them. The room name and the inviter's
display name are stripped of control characters, including the
bidirectional controls `char::is_control` misses, and truncated before
they are stored in the job payload. The inviter's Matrix ID is never
truncated, so it can't show a server it isn't from: it is kept whole if
it is valid under the historical grammar, and left out otherwise.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqDpJbETzs7DLgqpMfkYtG
2026-11-10 00:59:45 +00:00
Devon HudsonandClaude Opus 5.5 fc4fe8efdc Replace a registration token's allowed email addresses
`PUT /api/admin/v1/user-registration-tokens/{id}` takes `allowed_emails`,
which replaces the whole list, with the checks it gets when minting, and
null removes it. A token pinning an email, or one that isn't
passwordless, can't get a list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqDpJaaUkGGq5GiEbU9G3f
2026-11-10 00:59:45 +00:00
Devon HudsonandClaude Opus 5.5 6a97b7d13e Take allowed email addresses when minting a registration token
`allowed_emails` lists the addresses that may register with the token.
Each must be an address the registration policy accepts, as a pinned
email must, and repeats in another case are dropped. A token pins an
email or lists addresses, not both, and only a passwordless token
lists them. The admin API shows the list on every token.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqDpJaaUkGGq5GiEbU9G3f
2026-11-10 00:59:45 +00:00
Devon HudsonandClaude Opus 5.5 52437ff8e3 Let a registration token's username be a template
A token's `username` containing `{` is a minijinja template, rendered
when registering with `random` set to 32 lowercase letters and digits.
Localparts can't contain `{`, so no username a token could otherwise
pin is read as one.

Adding a token checks a template by rendering it with a sample `random`,
in strict mode so an unknown variable is an error rather than an empty
string, and runs the registration policy on the result. A template that
doesn't render is a 400 carrying the render error. The name a template
renders to is only known when registering, so the username-taken check
applies to literal usernames only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqDpJaaUkGGq5GiEbU9G3f
2026-11-10 00:59:31 +00:00
Devon HudsonandClaude f5ea2a4349 Store a continue URL on registration tokens
A registration token can now carry a URL, for its link to send the user
to once they have registered or signed in. The admin API takes
`continue_url` when adding a token and reports it on every token. It
refuses anything but an http or https URL, and keeps the URL as given.

MAS doesn't read the URL. Whoever mints the token decides where it
leads, such as a room in a web client, or a page that lets the user
pick a client.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqDpJbETzs7DLgqpMfkYtG
2026-11-10 00:59:31 +00:00
Devon HudsonandClaude Opus 5.5 e5381153c9 Report a token's invite_url in the admin API
Every registration token the admin API returns now carries `invite_url`,
the `/register?token=…` link which opens the registration page with that
token, so that an admin client can hand it to the invitee as is. The
token endpoints take the `UrlBuilder` to build it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqDpJaaUkGGq5GiEbU9G3f
2026-11-06 20:20:03 +00:00
Devon HudsonandClaude Opus 5.5 076673b73d Add a passwordless flag to registration tokens
A registration token can now be marked `passwordless`, which will let the
user register without picking a password: their identity is established
by verifying their email address instead. The admin API takes the flag
when creating a token and reports it on every token it returns, and
`manage issue-user-registration-token` takes `--passwordless`.

This only stores the flag; the registration flow doesn't use it yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqDpJaaUkGGq5GiEbU9G3f
2026-11-06 19:47:40 +00:00
Devon HudsonandClaude Opus 5.5 ba7a1d1492 Add a username and an email address to registration tokens
A registration token can now carry the username and the email address
the account registered with it has to use. The admin API takes both when
creating a token and reports them on every token it returns, and
`manage issue-user-registration-token` takes `--username` and `--email`.

The admin API checks the pins when a token is created, so that it
doesn't mint a token nobody can register with: a pinned email must
parse, both must pass the registration policy, and a pinned username
must not be taken already.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FqDpJaaUkGGq5GiEbU9G3f
2026-11-06 19:36:59 +00:00
Quentin Gliech 882eb8ef29 Regenerate the JSON schemas for schemars 1.2.3 2026-11-02 13:08:46 +01:00
Jason Robinson b3a0a565b1 Unify how id is represented in the examples 2026-10-29 11:16:35 +02:00
Jason RobinsonandQuentin Gliech 61f7c38117 Apply batched suggestions from code review
Co-authored-by: Quentin Gliech <quenting@element.io>
2026-10-29 11:13:56 +02:00
Jason Robinson 37b0014853 Add example for setting up ProConnect SSO provider 2026-10-28 15:05:40 +02:00
Jason Robinson c5270fc77e Re-order sso.md example platforms alphabetically
Sorry 😅
2026-10-28 14:55:03 +02:00
Quentin Gliech d679c84002 Disable Sentry tracing when traces_sample_rate is not set
An unset `telemetry.sentry.traces_sample_rate` used to mean a rate of
0.0, which still records the transaction of any request carrying a
sampled `sentry-trace` header. Since any client can send that header,
leaving the option unset now disables tracing entirely. Setting it to
0.0 explicitly keeps the previous behaviour.
2026-10-28 10:22:11 +01:00
Quentin Gliech 24683fb938 Add a usernameAvailable GraphQL query for anonymous lookups
Exposes a new query telling whether a given username is available for
registration, and if not, why: already taken, or rejected by the
registration policy. A username reserved on the homeserver side is
deliberately reported as taken, mirroring the ambiguity of the
registration form, which doesn't tell the two apart either.

Because the query reveals whether a username exists, it is rate-limited
per requester, configurable through the new
`rate_limiting.username_availability` option.
2026-10-16 11:34:22 +02:00
Paul Chobert 6a105cc52c Merge remote-tracking branch 'upstream/main' into docs-msc4190-appservice-devices
# Conflicts:
#	docs/as-login.md
2026-09-30 10:11:57 +02:00
Paul Chobert 52dfde42e8 docs: Refer to the spec rather than MSC4190 for appservice device management
The device management endpoints are part of the Application Service API
since Matrix 1.17, so point at the spec instead of the proposal.
2026-09-30 10:08:56 +02:00
Eric Eastwood 8898c7ba79 Link [translations-download workflow] 2026-09-21 11:16:44 -05:00
Eric Eastwood 1296cb5440 Link to CI from @ElementBot 2026-09-21 11:16:05 -05:00
Hugh Nimmo-Smith 357f83c96a Rate limit device code link attempts
Add a dedicated `device_code_link` rate limiter for device authorization user code verification.

This is to help mitigate the User Code Brute Forcing attack as described by [RFC 8628 section 5.1](https://datatracker.ietf.org/doc/html/rfc8628#section-5.1)

Proposed default is 1 per minute and burst of 10. This can be overridden by the server admin.
2026-09-11 13:17:56 +01:00
Quentin Gliech 7891a7a31b Fix positional arguments in manage CLI docs (#5964) 2026-09-08 12:36:53 +02:00
Quentin Gliech 065ff2fe55 CI: move to pnpm/setup for installing node, pnpm and installing frontend dependencies (#5965) 2026-09-08 12:18:46 +02:00
Quentin Gliech dbbb93915e Declare the Node.js version in devEngines.runtime
`pnpm/setup` reads the runtime version from `package.json` and ignores `.node-version`. With `onFail: download`, pnpm records Node 24.15.0 in the lockfile and downloads it on every install unless `--no-runtime` is passed. The Dockerfile and the docs build pass it, since they already run a pinned Node. `.node-version` stays for the Cloudflare Pages build, which reads it to pick the Node that bootstraps corepack.
2026-09-07 16:04:48 +02:00
Noah Gao aeae198d0e docs: fix manage command positional arguments 2026-09-06 02:57:35 +08:00
Quentin Gliech 04fdf83b11 Merge branch 'main' into docs-msc4190-appservice-devices 2026-09-03 19:54:58 +02:00
Paul Chobert d3cf92fd24 docs: Remove the appservice login warning page
The page said encrypted bridges cannot work with MAS and that a solution
was being worked on. That solution is MSC4190, stable since Matrix 1.17
and enabled for every application service in Synapse 1.141.0, so the
limitation no longer exists.

Replace the page with a readiness item on the migration page, which is
where the original warning was aimed, and redirect the old URL there.
2026-09-03 15:48:38 +02:00
Paul Chobert aa8b6b9a27 Merge branch 'main' into fix-missing-appservice-login-unsupported 2026-09-03 15:28:01 +02:00
Paul Chobert 765fa97ffe Return M_APPSERVICE_LOGIN_UNSUPPORTED for m.login.application_service
Matrix 1.17 requires servers that don't support the legacy
authentication API to reject `m.login.application_service` on
`/login` with a 400 and the `M_APPSERVICE_LOGIN_UNSUPPORTED` error
code. Previously this login type fell through the generic unsupported
credentials path and returned `M_UNKNOWN`, which appservices written
against Matrix 1.17 can't distinguish from an unrelated failure.
2026-09-03 11:10:26 +02:00
Quentin Gliech 8bef2570c0 Pin the Rust toolchain for CI build jobs and let dependabot update it (#5938) 2026-09-02 14:44:02 +02:00
Olivier 'reivilibre e94477d1b3 docs: Merge error description for the same status code (#5911) 2026-08-27 14:57:32 +01:00
Quentin Gliech 66e73f9910 Pin the Rust toolchain with a rust-toolchain.toml
Until now only the clippy CI job and the Dockerfile named a Rust version (kept in sync by hand), while every other CI job, the release binaries and the docs build ran on whatever `stable` happened to be that day. Rust 1.98.0 landing on 2026-08-20 broke `build-binaries` overnight because of that (#5935).

`rust-toolchain.toml` pins 1.96.0 with the `minimal` profile plus clippy, and every `rustup toolchain install stable ...` in CI becomes a bare `rustup toolchain install`, which reads the file. Starting at 1.96.0 (the version clippy is already clean against) keeps this change free of lint churn; catching up to 1.98.0 is a follow-up.

rustfmt stays on nightly because `.rustfmt.toml` uses nightly-only options, so that job now invokes `cargo +nightly fmt` explicitly instead of setting a rustup directory override, which would silently take precedence over the toolchain file.

The file does not list the linux cross-compilation targets on purpose: that would make every developer and CI job download `rust-std` they never use. The two consumers that cross-compile add the targets themselves.
2026-08-26 12:01:34 +02:00
Quentin Gliech c3b5fa3b0c Remove the GraphQL playground
The interactive playground page and its route/config option are gone; the GraphQL API itself (POST /graphql) is unaffected. External GraphQL usage is deprecated anyway in favour of the REST admin API.
2026-08-07 12:26:42 +02:00
Kai A. Hiller 5647b8a8a4 Update schema 2026-08-07 02:08:51 +02:00
Quentin Gliech 7abe147ba0 Expose a logged_out variable to upstream authorization parameter templates (#5859) 2026-07-29 17:57:55 +02:00
Quentin GliechandAndrew Morgan cae99ccef3 Adapt punctionation in docs
Co-Authored-By: Andrew Morgan <andrewm@element.io>
2026-07-29 14:52:02 +02:00
Quentin Gliech 9d521acd02 Replace Unix socket on startup & allow setting permissions (#5858) 2026-07-28 13:48:39 +02:00
Quentin Gliech 406d678a6f Add a filter[human-account-name] param to the upstream OAuth links admin API
Fuzzy (case-insensitive substring) search on the link's human account
name.
2026-07-27 16:09:01 +02:00
networkException bdfeee2ceb Add password_file config variant for email and database 2026-07-26 17:57:40 +02:00
Kai A. Hiller 02a216d071 Update schema 2026-07-24 13:27:11 +02:00
Eric Eastwood 819957eeb8 Move "Full release process" section higher up 2026-07-15 15:00:45 -05:00
Quentin Gliech cd78f82f9c Replace Unix socket on startup & allow setting permissions
Fixes #5572
Fixes #2424

This makes it so that MAS binds on a temporary path on startup, sets
permissions and then moves it to the configured path. This means that we don't
error out anymore if there is a stale socket file, and that it is safe to
rollout a new process without killing the old one first, without breaking
connections.
2026-07-13 13:46:47 +02:00