diff --git a/package.json b/package.json index d4e2bfa8..c752c778 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "matrix-appservice-bridge": "^10.3.1", "matrix-bot-sdk": "npm:@vector-im/matrix-bot-sdk@^0.7.1-element.6", "matrix-protection-suite": "npm:@gnuxie/matrix-protection-suite@3.6.1", - "matrix-protection-suite-for-matrix-bot-sdk": "npm:@gnuxie/matrix-protection-suite-for-matrix-bot-sdk@3.6.2", + "matrix-protection-suite-for-matrix-bot-sdk": "npm:@gnuxie/matrix-protection-suite-for-matrix-bot-sdk@3.6.3", "pg": "^8.8.0", "yaml": "^2.3.2" }, diff --git a/src/capabilities/SynapseAdminRoomTakedown/SynapseAdminRoomTakedown.ts b/src/capabilities/SynapseAdminRoomTakedown/SynapseAdminRoomTakedown.ts index 4c61fa76..2cb77cf7 100644 --- a/src/capabilities/SynapseAdminRoomTakedown/SynapseAdminRoomTakedown.ts +++ b/src/capabilities/SynapseAdminRoomTakedown/SynapseAdminRoomTakedown.ts @@ -31,7 +31,7 @@ export class SynapseAdminRoomDetailsProvider implements RoomDetailsProvider { } else { return Ok({ name: detailsResponse.ok?.name ?? undefined, - creator: detailsResponse.ok?.creator, + creator: detailsResponse.ok?.creator ?? undefined, avatar: detailsResponse.ok?.avatar ?? undefined, topic: detailsResponse.ok?.topic ?? undefined, joined_members: detailsResponse.ok?.joined_members ?? undefined, diff --git a/src/protections/RoomTakedown/DiscoveredRoomStore.ts b/src/protections/RoomTakedown/DiscoveredRoomStore.ts index a9ef32ef..a436bc05 100644 --- a/src/protections/RoomTakedown/DiscoveredRoomStore.ts +++ b/src/protections/RoomTakedown/DiscoveredRoomStore.ts @@ -4,8 +4,8 @@ import { isError, Ok, Result } from "@gnuxie/typescript-result"; import { + roomIDServerName, StringRoomID, - userServerName, } from "@the-draupnir-project/matrix-basic-types"; import { Logger, @@ -23,6 +23,23 @@ export type RoomToCheck = { details?: RoomBasicDetails | undefined; }; +/** + * Currently the store is polluted because of https://github.com/element-hq/synapse/issues/18563 + * Because of the fallout of this bug, there will be room details polluted in the following way: + * + * 1. empty string for `server`. + * 2. empty string for `creator`. + * + * To cleanup, we probably need to destroy the details table entirely + * and create a table for the server responsible for creating the room derived + * from the room_id. + * Then later if we find a way of obtaining the creator, we can store that + * instead. + * + * The reason why this didn't happen in the first place is because we thought + * that the creator would always be available and we would always derive the + * server from the creator. + */ export class StandardDiscoveredRoomStore extends EventEmitter implements RoomDiscovery @@ -62,7 +79,7 @@ export class StandardDiscoveredRoomStore const storeResult = await this.hashStore.storeRoomIdentification({ creator: details.creator, roomID: details.room_id, - server: userServerName(details.creator), + server: roomIDServerName(details.room_id), }); if (isError(storeResult)) { log.error( diff --git a/yarn.lock b/yarn.lock index 0685e944..7b0ecb64 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2598,10 +2598,10 @@ matrix-appservice@^2.0.0: request-promise "^4.2.6" sanitize-html "^2.11.0" -"matrix-protection-suite-for-matrix-bot-sdk@npm:@gnuxie/matrix-protection-suite-for-matrix-bot-sdk@3.6.2": - version "3.6.2" - resolved "https://registry.yarnpkg.com/@gnuxie/matrix-protection-suite-for-matrix-bot-sdk/-/matrix-protection-suite-for-matrix-bot-sdk-3.6.2.tgz#c412ff58483c80ccc5c36a19054e8278163a4426" - integrity sha512-C9CtXXFYszUNJUR6rgEu6z9oyH56x12OYkce4/KKNUVMAaBAGQJmFI7yaRm+wA2XfIINJibJsHh1ddoBl7y/4A== +"matrix-protection-suite-for-matrix-bot-sdk@npm:@gnuxie/matrix-protection-suite-for-matrix-bot-sdk@3.6.3": + version "3.6.3" + resolved "https://registry.yarnpkg.com/@gnuxie/matrix-protection-suite-for-matrix-bot-sdk/-/matrix-protection-suite-for-matrix-bot-sdk-3.6.3.tgz#4c99dcde1762e6f4887dc3cf1ff9473f50f56f00" + integrity sha512-2ZTaD2pBOHjXnxHXTeU33YkxR3J3eC8d7Jj+h1hvCIhGCvSWJml48MIovYlR7/z3J0KWZLS/87s3/YsUV7uJPw== dependencies: "@gnuxie/typescript-result" "^1.0.0" await-lock "^2.2.2"