WIP: Fix appservice user creation (fixes #813) #918

Draft
tcpipuk wants to merge 2 commits from fix-813-appservice-user-creation into main
Owner

This PR fixes issue #813 where appservice users were not being created, preventing appservices from functioning correctly:

  • Creates the appservice user (sender_localpart) during initial registration
  • Also creates users during authentication to handle existing appservices registered before this fix

The issue was that when an appservice registered, the corresponding user account for the sender_localpart was never created, which prevented:

  • Direct messages to the appservice bot user
  • The appservice from properly acting as its designated user

The fix should ensure that missing user accounts are created both:

  1. During initial appservice registration (for new appservices)
  2. During authentication (for existing appservices, so fixing them automatically)
This PR fixes issue #813 where appservice users were not being created, preventing appservices from functioning correctly: - Creates the appservice user (sender_localpart) during initial registration - Also creates users during authentication to handle existing appservices registered before this fix The issue was that when an appservice registered, the corresponding user account for the `sender_localpart` was never created, which prevented: - Direct messages to the appservice bot user - The appservice from properly acting as its designated user The fix should ensure that missing user accounts are created both: 1. During initial appservice registration (for new appservices) 2. During authentication (for existing appservices, so fixing them automatically)
tcpipuk self-assigned this 2025-08-04 19:58:09 +00:00
tcpipuk added 2 commits 2025-08-04 19:58:09 +00:00
fix(appservice): Create appservice user on registration
All checks were successful
Checks / Prefligit / prefligit (push) Successful in 26s
Checks / Rust / Format (push) Successful in 57s
Checks / Rust / Clippy (push) Successful in 4m26s
Checks / Rust / Cargo Test (push) Successful in 4m52s
15ee7559ea
Fixes #813 where appservice users were not being created when the
appservice was registered, causing bridges like mautrix-telegram
to fail on startup.

The fix creates the appservice's sender_localpart user if it doesn't
already exist during the registration process, matching the expected
Matrix appservice behaviour.
fix(appservice): Create user on authentication for existing appservices
All checks were successful
Release Docker Image / define-variables (push) Successful in 3s
Checks / Prefligit / prefligit (push) Successful in 14s
Checks / Rust / Format (push) Successful in 39s
Checks / Rust / Clippy (push) Successful in 4m8s
Checks / Rust / Cargo Test (push) Successful in 4m50s
Release Docker Image / build-image (linux/amd64, release, linux-amd64, base) (push) Successful in 13m22s
Release Docker Image / build-image (linux/arm64, release, linux-arm64, base) (push) Successful in 13m56s
Release Docker Image / merge (push) Successful in 21s
Checks / Prefligit / prefligit (pull_request) Successful in 14s
Documentation / Build and Deploy Documentation (pull_request) Successful in 36s
3e68b67562
Ensures appservice users are created during authentication requests,
fixing the issue for appservices registered before the initial fix.
This allows existing appservices to work without re-registration.
Jade requested changes 2025-08-05 14:02:51 +00:00
@ -220,6 +220,10 @@ async fn auth_appservice(
return Err!(Request(Exclusive("User is not in namespace.")));
}
if !services.users.exists(&user_id).await {
Owner

This would create for any user in the regex, not sure we need to do that - I think the issue was the account in sender_localpart? Ignore me if I'm wrong here

This would create for any user in the regex, not sure we need to do that - I think the issue was the account in `sender_localpart`? Ignore me if I'm wrong here
Owner

If it is what needs to happen, then it should only happen for exclusive namespaces to stop, e.g. doublepuppetting from accidentally creating accounts.

If it *is* what needs to happen, then it should only happen for exclusive namespaces to stop, e.g. doublepuppetting from accidentally creating accounts.
All checks were successful
Release Docker Image / define-variables (push) Successful in 3s
Checks / Prefligit / prefligit (push) Successful in 14s
Required
Details
Checks / Rust / Format (push) Successful in 39s
Required
Details
Checks / Rust / Clippy (push) Successful in 4m8s
Required
Details
Checks / Rust / Cargo Test (push) Successful in 4m50s
Required
Details
Release Docker Image / build-image (linux/amd64, release, linux-amd64, base) (push) Successful in 13m22s
Release Docker Image / build-image (linux/arm64, release, linux-arm64, base) (push) Successful in 13m56s
Release Docker Image / merge (push) Successful in 21s
Checks / Prefligit / prefligit (pull_request) Successful in 14s
Required
Details
Documentation / Build and Deploy Documentation (pull_request) Successful in 36s
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix-813-appservice-user-creation:fix-813-appservice-user-creation
git checkout fix-813-appservice-user-creation
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#918
No description provided.