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

[pseudoIDs] Allow displayname changes, kick users on redaction #3131

Closed
wants to merge 24 commits into from

Conversation

S7evinK
Copy link
Contributor

@S7evinK S7evinK commented Jul 3, 2023

This PR changes a few things to allow displayname/avatar changes in pseudo ID rooms.

  • GetRoomsByMembership now queries the pseudo ID keys to get all rooms
  • When redacting a join event containing a mxid_mapping in content, the user leaves the room or is kicked
  • When redacting an event, we now also redact it in current_room_state (if needed)
  • When storing a membership event (e.g. join -> join) we now remove the mxid_mapping from unsigned.prev_content)
  • When receiving a membership event over federation, we check if it is a join -> join event and temporarily add a prev_content, so validating the event signature doesn't error because of a missing mxid_mapping

A few things we need to think about:
Considering that users can leave rooms on their own and rejoin them, we now have two join events with a mxid_mapping. Currently redacting the current join event results in a leave/kick, but we still have another unredacted mxid_mapping. It's up to the client to walk the unsigned.replaces_state field to redact other membership events containing a mxid_mapping

Kicking users, on redaction of a join event, may not always be possible, as the powerlevels could have been changed to allow redactions for PL50, but kicking is only allowed for PL100. How do we handle those cases? Temporarily fake/update the powerlevels to allow kicking?

@S7evinK S7evinK added the T-Enhancement New features, changes in functionality, improvements in performance, or user-facing enhancements. label Jul 3, 2023
@S7evinK S7evinK requested a review from a team as a code owner July 3, 2023 07:23
@codecov
Copy link

codecov bot commented Jul 3, 2023

Codecov Report

Attention: Patch coverage is 42.50000% with 138 lines in your changes missing coverage. Please review.

Project coverage is 64.31%. Comparing base (c809e95) to head (cae2b61).
Report is 120 commits behind head on main.

Files Patch % Lines
roomserver/internal/input/input_events.go 7.14% 65 Missing ⚠️
roomserver/storage/shared/storage.go 62.50% 13 Missing and 5 partials ⚠️
roomserver/internal/query/query.go 0.00% 9 Missing ⚠️
syncapi/storage/shared/storage_consumer.go 70.96% 6 Missing and 3 partials ⚠️
...oomserver/storage/postgres/user_room_keys_table.go 68.42% 4 Missing and 2 partials ⚠️
roomserver/storage/sqlite3/membership_table.go 70.00% 3 Missing and 3 partials ⚠️
roomserver/storage/sqlite3/user_room_keys_table.go 68.42% 4 Missing and 2 partials ⚠️
syncapi/consumers/roomserver.go 37.50% 4 Missing and 1 partial ⚠️
roomserver/internal/perform/perform_backfill.go 0.00% 4 Missing ⚠️
federationapi/internal/perform.go 0.00% 3 Missing ⚠️
... and 3 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3131      +/-   ##
==========================================
- Coverage   64.44%   64.31%   -0.14%     
==========================================
  Files         506      506              
  Lines       57011    57202     +191     
==========================================
+ Hits        36743    36788      +45     
- Misses      16442    16576     +134     
- Partials     3826     3838      +12     
Flag Coverage Δ
unittests 49.07% <42.50%> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

roomserver/storage/interface.go Show resolved Hide resolved
internal/transactionrequest.go Outdated Show resolved Hide resolved
@S7evinK
Copy link
Contributor Author

S7evinK commented Aug 3, 2024

Not needed anymore, iirc.

@S7evinK S7evinK closed this Aug 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-Enhancement New features, changes in functionality, improvements in performance, or user-facing enhancements.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants