WIP: Support fi.mau.room_id, and fully qualified room_id in /createRoom #777

Draft
nex wants to merge 2 commits from nex/custom-room-id into main
Owner

allows both the unspecced room_id and the custom fi.mau.room_id to be used, by validating and supporting both when the value is a fully qualified room ID, or when it's just a localpart.

This also removes the restrictions that prevents spaces being in the room ID, which is not a real restriction.

This is working on my dev server, and providing test to fi.mau.room_id created !test:continuwuity-dev.nexy7574.co.uk, and passing !test-2:continuwuity-dev:nexy7574.co.uk created the expected room ID.

closes #776. Depends on continuwuation/ruwuma#21.

allows both the unspecced `room_id` and the custom `fi.mau.room_id` to be used, by validating and supporting both when the value is a fully qualified room ID, or when it's just a localpart. This also removes the restrictions that prevents spaces being in the room ID, which is not a real restriction. This is working on my dev server, and providing `test` to `fi.mau.room_id` created `!test:continuwuity-dev.nexy7574.co.uk`, and passing `!test-2:continuwuity-dev:nexy7574.co.uk` created the expected room ID. closes #776. Depends on continuwuation/ruwuma#21.
nex added the
Enhancement
label 2025-04-20 01:36:02 +00:00
nex added 1 commit 2025-04-20 01:36:02 +00:00
Support fi.mau.room_id, and fully qualified room_id in /createRoom
Some checks failed
Release Docker Image / define-variables (push) Failing after 1s
Release Docker Image / build-image (linux/amd64, linux-amd64) (push) Has been skipped
Release Docker Image / build-image (linux/arm64, linux-arm64) (push) Has been skipped
Release Docker Image / merge (push) Has been skipped
Release Docker Image / define-variables (pull_request) Successful in 12s
Documentation / Build and Deploy Documentation (pull_request) Successful in 39s
Release Docker Image / build-image (linux/amd64, linux-amd64) (pull_request) Successful in 18m23s
Release Docker Image / build-image (linux/arm64, linux-arm64) (pull_request) Successful in 58m31s
Release Docker Image / merge (pull_request) Successful in 25s
6920814da9
nex added a new dependency 2025-04-20 01:36:37 +00:00
requested review from Owners 2025-04-20 01:36:45 +00:00
nex added 1 commit 2025-04-20 01:46:25 +00:00
Prevent creating custom room IDs belonging to other servers
Some checks failed
Release Docker Image / define-variables (push) Successful in 3s
Documentation / Build and Deploy Documentation (pull_request) Failing after 1s
Release Docker Image / define-variables (pull_request) Failing after 0s
Release Docker Image / build-image (linux/amd64, linux-amd64) (pull_request) Has been skipped
Release Docker Image / build-image (linux/arm64, linux-arm64) (pull_request) Has been skipped
Release Docker Image / merge (pull_request) Has been skipped
Release Docker Image / build-image (linux/amd64, linux-amd64) (push) Successful in 17m25s
Release Docker Image / build-image (linux/arm64, linux-arm64) (push) Successful in 18m6s
Release Docker Image / merge (push) Successful in 30s
d3022b4112
Author
Owner

d3022b4112 is misleading, the check is successful:

2025-04-20T01:50:27.471680Z DEBUG router{method=POST path=/_matrix/client/v3/createRoom}:request:handle{active=1 handled=11}: conduwuit_api::router::args: POST /_matrix/client/v3/createRoom {"host": "localhost:8008", "user-agent": "gomuks/0.4.0+dev.31e6b973 mautrix-go/v0.23.2+dev.99ff0c09 go/1.24.1", "content-length": "260", "authorization": Sensitive, "content-type": "application/json", "accept-encoding": "gzip"}
2025-04-20T01:50:27.471786Z  INFO router{method=POST path=/_matrix/client/v3/createRoom}:request:handle{active=1 handled=11}: conduwuit_api::client::room::create: Full custom room ID full_room_id="!test4:continuwuity.nexy7574.co.uk"
  2025-04-20T01:50:27.471828Z ERROR conduwuit_api::client::room::create: Custom room ID does not match server name
    at src/api/client/room/create.rs:627 on conduwuit:worker ThreadId(11)
    in conduwuit_router::request::handle with active=1 handled=11
    in conduwuit_router::request::request
    in conduwuit_router::layers::router with method=POST path=/_matrix/client/v3/createRoom

but the returned error is an unauthorized error: M_FORBIDDEN (HTTP 403): M_FORBIDDEN: Event is not authorized. (it should be a 422: invalid room ID)

Retrying the request erroneously returns M_ROOM_IN_USE (HTTP 400): M_ROOM_IN_USE: Room with that custom room ID already exists, which gives me the gut feeling that if the bad room ID is re-used later (in a legitimate server for example) it may cause conflicts. That should be looked at before this gets merged.

d3022b4112 is misleading, the check is successful: ``` 2025-04-20T01:50:27.471680Z DEBUG router{method=POST path=/_matrix/client/v3/createRoom}:request:handle{active=1 handled=11}: conduwuit_api::router::args: POST /_matrix/client/v3/createRoom {"host": "localhost:8008", "user-agent": "gomuks/0.4.0+dev.31e6b973 mautrix-go/v0.23.2+dev.99ff0c09 go/1.24.1", "content-length": "260", "authorization": Sensitive, "content-type": "application/json", "accept-encoding": "gzip"} 2025-04-20T01:50:27.471786Z INFO router{method=POST path=/_matrix/client/v3/createRoom}:request:handle{active=1 handled=11}: conduwuit_api::client::room::create: Full custom room ID full_room_id="!test4:continuwuity.nexy7574.co.uk" 2025-04-20T01:50:27.471828Z ERROR conduwuit_api::client::room::create: Custom room ID does not match server name at src/api/client/room/create.rs:627 on conduwuit:worker ThreadId(11) in conduwuit_router::request::handle with active=1 handled=11 in conduwuit_router::request::request in conduwuit_router::layers::router with method=POST path=/_matrix/client/v3/createRoom ``` but the returned error is an unauthorized error: `M_FORBIDDEN (HTTP 403): M_FORBIDDEN: Event is not authorized.` (it should be a 422: invalid room ID) Retrying the request erroneously returns `M_ROOM_IN_USE (HTTP 400): M_ROOM_IN_USE: Room with that custom room ID already exists`, which gives me the gut feeling that if the bad room ID is re-used later (in a legitimate server for example) it may cause conflicts. That should be looked at before this gets merged.
nex changed title from Support fi.mau.room_id, and fully qualified room_id in /createRoom to WIP: Support fi.mau.room_id, and fully qualified room_id in /createRoom 2025-04-20 01:52:33 +00:00
removed review request for Owners 2025-04-20 01:52:34 +00:00
Some checks failed
Release Docker Image / define-variables (push) Successful in 3s
Documentation / Build and Deploy Documentation (pull_request) Failing after 1s
Release Docker Image / define-variables (pull_request) Failing after 0s
Release Docker Image / build-image (linux/amd64, linux-amd64) (pull_request) Has been skipped
Release Docker Image / build-image (linux/arm64, linux-arm64) (pull_request) Has been skipped
Release Docker Image / merge (pull_request) Has been skipped
Release Docker Image / build-image (linux/amd64, linux-amd64) (push) Successful in 17m25s
Release Docker Image / build-image (linux/arm64, linux-arm64) (push) Successful in 18m6s
Release Docker Image / merge (push) Successful in 30s
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 nex/custom-room-id:nex/custom-room-id
git checkout nex/custom-room-id

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git checkout main
git merge --no-ff nex/custom-room-id
git checkout nex/custom-room-id
git rebase main
git checkout main
git merge --ff-only nex/custom-room-id
git checkout nex/custom-room-id
git rebase main
git checkout main
git merge --no-ff nex/custom-room-id
git checkout main
git merge --squash nex/custom-room-id
git checkout main
git merge --ff-only nex/custom-room-id
git checkout main
git merge nex/custom-room-id
git push origin main
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference: continuwuation/continuwuity#777
No description provided.