Skip to content

Commit ca1fa2c

Browse files
committed
Attempt to allow Draupnir to use room V12.
- Updated to matrix-basic-types 1.4.0 which changes the regex validating room ids. - Changed the package override so that all dependencies use matrix-basic-types 1.4.0, including the matrix-protection-suite. - Removed code that tries to store details about discovered rooms in the room takdedown protection. These were unreliable for so many reasons and also are now broken given the room origin cannot be extracted from the room id. Details for why this is can be found in the reviews of matrix-org/matrix-spec-proposals#4291.
1 parent 0618eee commit ca1fa2c

File tree

5 files changed

+24
-26
lines changed

5 files changed

+24
-26
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"@sentry/node": "^7.17.2",
5353
"@sinclair/typebox": "0.34.13",
5454
"@the-draupnir-project/interface-manager": "4.1.0",
55-
"@the-draupnir-project/matrix-basic-types": "1.3.0",
55+
"@the-draupnir-project/matrix-basic-types": "1.4.0",
5656
"@the-draupnir-project/mps-interface-adaptor": "^0.4.1",
5757
"better-sqlite3": "^9.4.3",
5858
"body-parser": "^1.20.2",
@@ -71,7 +71,7 @@
7171
"overrides": {
7272
"matrix-bot-sdk": "$@vector-im/matrix-bot-sdk",
7373
"@vector-im/matrix-bot-sdk": "npm:@vector-im/matrix-bot-sdk@^0.7.1-element.6",
74-
"@the-draupnir-project/matrix-basic-types": "@the-draupnir-project/matrix-basic-types@1.2.0",
74+
"@the-draupnir-project/matrix-basic-types": "$the-draupnir-project/matrix-basic-types",
7575
"matrix-protection-suite": "$matrix-protection-suite"
7676
},
7777
"engines": {

src/backingstore/better-sqlite3/HashStore.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
import { isError, Ok, Result } from "@gnuxie/typescript-result";
1111
import {
12-
roomIDServerName,
1312
StringRoomID,
1413
StringServerName,
1514
StringUserID,
@@ -323,8 +322,7 @@ export class SqliteHashReversalStore
323322
(room_id: StringRoomID, sha256) => ({ room_id, sha256 }),
324323
(roomRecords) => {
325324
this.emit("ReversedHashes", roomRecords, [], []);
326-
},
327-
(roomRecord) => roomIDServerName(roomRecord.room_id)
325+
}
328326
);
329327
}
330328

src/protections/RoomTakedown/DiscoveredRoomStore.ts

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
// SPDX-License-Identifier: Apache-2.0
44

55
import { isError, Ok, Result } from "@gnuxie/typescript-result";
6-
import {
7-
roomIDServerName,
8-
StringRoomID,
9-
} from "@the-draupnir-project/matrix-basic-types";
6+
import { StringRoomID } from "@the-draupnir-project/matrix-basic-types";
107
import {
118
Logger,
129
RoomBasicDetails,
@@ -76,19 +73,9 @@ export class StandardDiscoveredRoomStore
7673
if (details.creator === undefined) {
7774
continue; // no point persisting details that don't have a creator.
7875
}
79-
const storeResult = await this.hashStore.storeRoomIdentification({
80-
creator: details.creator,
81-
roomID: details.room_id,
82-
server: roomIDServerName(details.room_id),
83-
});
84-
if (isError(storeResult)) {
85-
log.error(
86-
"Error storing room details for a room",
87-
roomID,
88-
details,
89-
storeResult
90-
);
91-
}
76+
// TODO: normally we would store details about the room, such as the creator,
77+
// and the server, but currently this is unviable.
78+
// https://matrix.org/blog/2025/07/security-predisclosure/
9279
}
9380
return Ok(discoveredRooms);
9481
}

test/unit/stores/hashStoreTest.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ describe("meow", function () {
8989
const bannedServer = StringServerName("banned.example.com");
9090
const roomBannedViaServer = StringRoomID("!banned:banned.example.com");
9191
const policyRoom = randomRoomID([]);
92+
const roomCreator = StringUserID("@creator:banned.example.com");
9293
const bannedServerHash = base64sha256(bannedServer);
9394
const findResult = (await store.findServerHash(bannedServerHash)).expect(
9495
"Should be able to at least query this"
@@ -118,6 +119,18 @@ describe("meow", function () {
118119
(await store.storeUndiscoveredRooms([roomBannedViaServer])).expect(
119120
"Should be able to discover rooms jsut fine"
120121
);
122+
// previously storing an undiscovered room would extract the server name.
123+
// this is no longer possible to do indirectly https://matrix.org/blog/2025/07/security-predisclosure/.
124+
(
125+
await store.storeRoomIdentification({
126+
roomID: roomBannedViaServer,
127+
creator: roomCreator,
128+
server: bannedServer,
129+
})
130+
).expect("Should be able to store identification for the room");
131+
(await store.storeUndiscoveredUsers([roomCreator])).expect(
132+
"Should be able to store the creator of the room"
133+
);
121134
const foundHash = (await store.findServerHash(bannedServerHash)).expect(
122135
"Should be able to now find the server hash from the room we discovered"
123136
);

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,10 @@
319319
"@gnuxie/super-cool-stream" "^0.2.1"
320320
"@gnuxie/typescript-result" "^1.0.0"
321321

322-
"@the-draupnir-project/matrix-basic-types@1.3.0":
323-
version "1.3.0"
324-
resolved "https://registry.yarnpkg.com/@the-draupnir-project/matrix-basic-types/-/matrix-basic-types-1.3.0.tgz#02fa9bd75eeed778a57da0844447feca3a4c663c"
325-
integrity sha512-WkUD7cqs9qFr1NQZiJWxa+/1trWrhQqv8SbPxrMLRKv1LMm93ELeguROP470kHNWHrCkVcKmYQVc4uC2Yup+EQ==
322+
"@the-draupnir-project/matrix-basic-types@1.4.0":
323+
version "1.4.0"
324+
resolved "https://registry.yarnpkg.com/@the-draupnir-project/matrix-basic-types/-/matrix-basic-types-1.4.0.tgz#18fcfc7561ad495f4868ef4298131a3e20e7d946"
325+
integrity sha512-nKK9vmAXh87VwaANvlNlUaq/rIu50VcdRXfoPJB99RqY4dt6iXRu/1b8mQJ5rDCK4yun/4IyGexw6FVQAqT58Q==
326326
dependencies:
327327
"@gnuxie/typescript-result" "^1.0.0"
328328
glob-to-regexp "^0.4.1"

0 commit comments

Comments
 (0)