diff --git a/changelog.d/SEC48.bugfix.md b/changelog.d/SEC48.bugfix.md new file mode 100644 index 000000000..f51dac012 --- /dev/null +++ b/changelog.d/SEC48.bugfix.md @@ -0,0 +1 @@ +SEC48 fix. See at a later date for more info. Contributed by @jade. \ No newline at end of file diff --git a/src/web/pages/account/register.rs b/src/web/pages/account/register.rs index 0bd686adb..0e712c87e 100644 --- a/src/web/pages/account/register.rs +++ b/src/web/pages/account/register.rs @@ -329,6 +329,21 @@ async fn begin_registration( let open_registration = services.config.enable_challengeless_registration(); let mut errors = ValidationErrors::new(); + // The flow is chosen by the client, so make sure it's one we actually offer + let flow_status = services.uiaa.registration_flow_status().await; + let flow_available = match form.flow { + | RequestedRegistrationFlow::Trusted => + matches!(flow_status.trusted, TrustedFlowStatus::Available), + | RequestedRegistrationFlow::Untrusted => + matches!(flow_status.untrusted, UntrustedFlowStatus::Available { .. }), + }; + + if !flow_available { + return Err(WebError::Forbidden( + "This registration flow is not available on this server".to_owned(), + )); + } + let user_id = match services .users .determine_registration_user_id(Some(form.username), form.email.as_ref(), None)