Implement ReCaptcha registration flow #900

Merged
nex merged 9 commits from nex/feat/recaptcha into main 2025-07-08 19:06:53 +00:00
Owner

Implements the m.login.recaptcha flow, which allows servers to gate their registration behind a captcha, preventing automated signups.

Implements the `m.login.recaptcha` flow, which allows servers to gate their registration behind a captcha, preventing automated signups.
nex added the
Enhancement
Matrix/Client
Matrix/Auth
labels 2025-07-08 18:13:08 +00:00
nex added 4 commits 2025-07-08 18:13:09 +00:00
feat: Add ReCaptcha registration flow
Some checks failed
Release Docker Image / merge (push) Blocked by required conditions
Release Docker Image / define-variables (push) Successful in 1s
Checks / Prefligit / prefligit (push) Successful in 54s
Checks / Rust / Format (push) Successful in 54s
Checks / Rust / Clippy (push) Failing after 3m41s
Checks / Rust / Cargo Test (push) Successful in 4m51s
Release Docker Image / build-image (linux/amd64, release, linux-amd64, base) (push) Has been cancelled
Release Docker Image / build-image (linux/arm64, release, linux-arm64, base) (push) Has been cancelled
651d07a609
feat(recaptcha): Add documentation for new fields
Some checks failed
Release Docker Image / merge (push) Blocked by required conditions
Release Docker Image / define-variables (push) Successful in 14s
Checks / Prefligit / prefligit (push) Successful in 29s
Checks / Rust / Format (push) Successful in 1m3s
Checks / Rust / Clippy (push) Failing after 3m26s
Release Docker Image / build-image (linux/arm64, release, linux-arm64, base) (push) Has been cancelled
Release Docker Image / build-image (linux/amd64, release, linux-amd64, base) (push) Has been cancelled
Checks / Rust / Cargo Test (push) Failing after 18m48s
df1cb10a8e
feat(recaptcha): Disable treating captcha-enabled servers as abuse-prone
Some checks failed
Release Docker Image / build-image (linux/amd64, release, linux-amd64, base) (push) Blocked by required conditions
Release Docker Image / build-image (linux/arm64, release, linux-arm64, base) (push) Blocked by required conditions
Release Docker Image / merge (push) Blocked by required conditions
Checks / Rust / Clippy (push) Waiting to run
Checks / Rust / Cargo Test (push) Waiting to run
Checks / Prefligit / prefligit (push) Successful in 26s
Release Docker Image / define-variables (push) Successful in 2s
Checks / Rust / Format (push) Has been cancelled
e4a6abe15e
feat(recaptcha): Update example config after previous changes
Some checks failed
Checks / Prefligit / prefligit (push) Waiting to run
Release Docker Image / merge (push) Blocked by required conditions
Release Docker Image / define-variables (push) Successful in 6s
Checks / Rust / Format (push) Successful in 46s
Checks / Rust / Clippy (push) Failing after 3m55s
Checks / Prefligit / prefligit (pull_request) Successful in 35s
Documentation / Build and Deploy Documentation (pull_request) Successful in 46s
Checks / Rust / Cargo Test (push) Successful in 5m17s
Release Docker Image / build-image (linux/amd64, release, linux-amd64, base) (push) Has been cancelled
Release Docker Image / build-image (linux/arm64, release, linux-arm64, base) (push) Has been cancelled
980774a275
nex added 1 commit 2025-07-08 18:16:00 +00:00
feat(recaptcha): Fix linting issues
Some checks failed
Release Docker Image / build-image (linux/amd64, release, linux-amd64, base) (push) Blocked by required conditions
Release Docker Image / build-image (linux/arm64, release, linux-arm64, base) (push) Blocked by required conditions
Release Docker Image / merge (push) Blocked by required conditions
Release Docker Image / define-variables (push) Successful in 4s
Checks / Prefligit / prefligit (push) Successful in 26s
Checks / Rust / Format (push) Successful in 51s
Documentation / Build and Deploy Documentation (pull_request) Successful in 37s
Checks / Prefligit / prefligit (pull_request) Successful in 34s
Checks / Rust / Cargo Test (push) Failing after 2m53s
Checks / Rust / Clippy (push) Failing after 3m8s
f0994355d4
requested review from Jade 2025-07-08 18:18:40 +00:00
Jade approved these changes 2025-07-08 18:23:09 +00:00
@ -185,3 +185,4 @@
&& config.registration_token.is_none()
&& config.registration_token_file.is_none()
&& !(config.recaptcha_site_key.is_some() && config.recaptcha_private_site_key.is_some())
{
Owner

Might or might not still be worth having a note when recaptcha is set? Up to you

Might or might not still be worth having a note when recaptcha is set? Up to you
Author
Owner

yeah, might add a warning in since I still consider no-verification (token/email) "insecure", but it's not as insecure as "no confirmation at all".

Regardless, there's a warning just below anyway:

	if config.allow_registration
		&& config.yes_i_am_very_very_sure_i_want_an_open_registration_server_prone_to_abuse
		&& config.registration_token.is_none()
		&& config.registration_token_file.is_none()
	{
		warn!(
			"Open registration is enabled via setting \
			 `yes_i_am_very_very_sure_i_want_an_open_registration_server_prone_to_abuse` and \
			 `allow_registration` to true without a registration token configured. You are \
			 expected to be aware of the risks now. If this is not the desired behaviour, \
			 please set a registration token."
		);
	}

I think this is sufficient

yeah, might add a warning in since I still consider no-verification (token/email) "insecure", but it's not as insecure as "no confirmation at all". Regardless, there's a warning just below anyway: ```rs if config.allow_registration && config.yes_i_am_very_very_sure_i_want_an_open_registration_server_prone_to_abuse && config.registration_token.is_none() && config.registration_token_file.is_none() { warn!( "Open registration is enabled via setting \ `yes_i_am_very_very_sure_i_want_an_open_registration_server_prone_to_abuse` and \ `allow_registration` to true without a registration token configured. You are \ expected to be aware of the risks now. If this is not the desired behaviour, \ please set a registration token." ); } ``` I think this is sufficient
nex marked this conversation as resolved
@ -557,2 +557,4 @@
pub registration_token_file: Option<PathBuf>,
/// The public site key for reCaptcha. If this is provided, reCaptcha
/// becomes required during registration, **even if token registration is
Owner

So users need either to solve the captcha or give the token, but not both?

So users need either to solve the captcha or give the token, but not both?
Author
Owner

They need to do both if both are configured. If enabled, token is required first, and then captcha.

They need to do both if both are configured. If enabled, token is required first, and then captcha.
Owner

Perhaps clarify that, I misunderstood a bit

Perhaps clarify that, I misunderstood a bit
nex marked this conversation as resolved
@ -558,1 +558,4 @@
/// The public site key for reCaptcha. If this is provided, reCaptcha
/// becomes required during registration, **even if token registration is
/// enabled**.
Owner

FWIW this might be used for new auth's signup flow too, once that's implemented

FWIW this might be used for new auth's signup flow too, once that's implemented
nex marked this conversation as resolved
nex added 1 commit 2025-07-08 18:27:59 +00:00
feat(recaptcha): Fix linting issues after the linter fix lied to me
Some checks failed
Release Docker Image / merge (push) Blocked by required conditions
Checks / Prefligit / prefligit (push) Successful in 13s
Release Docker Image / define-variables (push) Successful in 13s
Checks / Prefligit / prefligit (pull_request) Successful in 30s
Checks / Rust / Format (push) Successful in 48s
Documentation / Build and Deploy Documentation (pull_request) Successful in 49s
Checks / Rust / Clippy (push) Successful in 3m17s
Release Docker Image / build-image (linux/amd64, release, linux-amd64, base) (push) Has been cancelled
Release Docker Image / build-image (linux/arm64, release, linux-arm64, base) (push) Has been cancelled
Checks / Rust / Cargo Test (push) Has been cancelled
ff805d8ae1
nex added 2 commits 2025-07-08 18:36:09 +00:00
docs(recaptcha): Clarify registration when token & captcha are configured
Some checks failed
Release Docker Image / build-image (linux/amd64, release, linux-amd64, base) (push) Blocked by required conditions
Release Docker Image / merge (push) Blocked by required conditions
Checks / Rust / Cargo Test (push) Waiting to run
Release Docker Image / define-variables (push) Successful in 4s
Checks / Prefligit / prefligit (push) Successful in 23s
Checks / Rust / Format (push) Successful in 48s
Documentation / Build and Deploy Documentation (pull_request) Successful in 44s
Checks / Prefligit / prefligit (pull_request) Successful in 22s
Checks / Rust / Clippy (push) Successful in 5m47s
Release Docker Image / build-image (linux/arm64, release, linux-arm64, base) (push) Has been cancelled
c362499cef
nex scheduled this pull request to auto merge when all checks succeed 2025-07-08 18:41:57 +00:00
nex added 1 commit 2025-07-08 18:47:48 +00:00
chore(recaptcha): Update example config file
All checks were successful
Documentation / Build and Deploy Documentation (pull_request) Successful in 49s
Checks / Prefligit / prefligit (pull_request) Successful in 32s
Release Docker Image / define-variables (push) Successful in 4s
Checks / Prefligit / prefligit (push) Successful in 24s
Documentation / Build and Deploy Documentation (push) Successful in 31s
Checks / Rust / Format (push) Successful in 1m1s
Checks / Rust / Clippy (push) Successful in 4m50s
Checks / Rust / Cargo Test (push) Successful in 5m15s
Release Docker Image / build-image (linux/amd64, release, linux-amd64, base) (push) Successful in 13m36s
Release Docker Image / build-image (linux/arm64, release, linux-arm64, base) (push) Successful in 13m36s
Release Docker Image / merge (push) Successful in 31s
b71186d958
Unsure how this managed to get past the `git commit -S -a`
but sure
nex merged commit b71186d958 into main 2025-07-08 19:06:53 +00:00
nex deleted branch nex/feat/recaptcha 2025-07-08 19:06:53 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: continuwuation/continuwuity#900
No description provided.