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

Creating and deleting aliases could be more consistent #7320

Open
matrixbot opened this issue Dec 17, 2023 · 0 comments
Open

Creating and deleting aliases could be more consistent #7320

matrixbot opened this issue Dec 17, 2023 · 0 comments

Comments

@matrixbot
Copy link
Collaborator

matrixbot commented Dec 17, 2023

This issue has been migrated from #7320.


This is the promised follow-up to #7052 about how to creating and deleting aliases could be more consistent. In general these are implemented via the create_association and delete_association methods of DirectoryHandler.

The checks done for each of these (copied from #7052 and clarified a bit) below. They're a bit confusing (and maybe make more sense as the flow-charts I wrote out), but the overall checks aren't too complicated.

Creation

  1. Check if the length is valid.
  2. If require_membership_for_aliases is true in the config, the creator must be in the room or be a server admin.
  3. The spam checker's user_may_create_room_alias method is queried.
  4. The alias_creation_rules are checked from the config.
  5. Services are checked to see whether they have an "exclusive lock" on an alias.

Deletion

  1. Ensure that the user is the room creator, if one exists.
  2. Ensure that the alias points to a room ID.
  3. The user must be one of the following:
    1. A server admin.
    2. In the room and have sufficient power level to delete an alias (>= moderator).
  4. Services are checked to see whether the have an "exclusive lock" on an alias.

Potential improvements

There aren't too many changes I came up with, but see ideas below:

  1. Check require_room_membership_for_aliases during alias deletion.
  2. Ensure that a user has the proper power level during creation (but that probably only makes sense for the canonical alias, which already happens).

There's a chance that some of the code could be re-used by combining some of the checks, but probably not. Frankly this might just be good enough the way it is.

@matrixbot matrixbot changed the title Dummy issue Creating and deleting aliases could be more consistent Dec 21, 2023
@matrixbot matrixbot reopened this Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant