Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spec-compliant localparts for virtual matrix users #1781

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

kbleeke
Copy link

@kbleeke kbleeke commented Oct 1, 2023

Closes #1780

I would like to have the option to create localparts for virtual matrix users that only contain valid characters according to

https://spec.matrix.org/v1.8/appendices/#user-identifiers

The spec then suggest to map characters like

https://spec.matrix.org/v1.8/appendices/#mapping-from-other-character-sets

Well, the "have the option" part is still missing from the config file.

If you are generally interested in accepting a PR for this, I will do my best to comply with Contributing.md

@Half-Shot
Copy link
Contributor

Hey there, I'd absolutely love to have this change included. It has been a long time coming. Obviously we'd need to be careful to support "legacy" identifiers as the old behaviour is widespread but I'd love to see this happen for new deployments.

Copy link
Contributor

@Half-Shot Half-Shot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Early thoughts

@@ -10,6 +10,9 @@ RUN cd freebindfree && make
# Typescript build
FROM node:18 as builder

RUN apt-get update && apt-get install -y node-gyp --no-install-recommends
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know what caused this to flag up? It's weird that you found this without changing the deps around at all.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea, it just failed to compile. I wrote this on a brand new VPS. The base images were all fresh downloads. Maybe the upstream image somehow removed node-gyp?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems node:18.17 works node:18.18 is missing node-gyp for some reason.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've had this before where minor image versions break (and then because we target a major version, you end up not noticing).

The change looks good then. I think in the future we're just going to have to start pinning versions strictly as we can't be having this.

return match[1];

// https://spec.matrix.org/v1.8/appendices/#mapping-from-other-character-sets
const unescaped = match[1].replaceAll(/=([0-9a-f][0-9a-f])/g,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest making this behaviour configurable for now so old deployments don't break (and defaulting to off). In a future PR we can start defaulting new deployments to using it, and somewhere down the line we should stop supporting the old mechansim.

Make sense?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, makes perfect sense.

I haven't looked at any configuration code yet. I will update this with a proposal for a configuration option

@@ -80,6 +80,7 @@ export interface IrcServerConfig {
federate: boolean;
};
matrixClients: {
matrixIdNormalization: number,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that I should make this an integer, in case there are more schemes in the future

Comment on lines +416 to +419
localPartCharacterMapping:
type: "integer"
minimum: 0
maximum: 1
Copy link
Author

@kbleeke kbleeke Oct 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to set a default value here so it doesn't break existing configs? Or does that happens automatically?

@kbleeke kbleeke marked this pull request as ready for review October 21, 2023 11:57
@kbleeke kbleeke requested a review from a team as a code owner October 21, 2023 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

localparts for virtual Matrix users contain capital letters
2 participants