Skip to content

Commit 1f8da29

Browse files
authored
Attempt to allow Draupnir to use room V12. (#918)
- 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 4e13f0d commit 1f8da29

File tree

5 files changed

+22
-11
lines changed

5 files changed

+22
-11
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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
import { isError, Ok, Result } from "@gnuxie/typescript-result";
66
import {
7-
roomIDServerName,
87
StringRoomID,
8+
userServerName,
99
} from "@the-draupnir-project/matrix-basic-types";
1010
import {
1111
Logger,
@@ -79,7 +79,7 @@ export class StandardDiscoveredRoomStore
7979
const storeResult = await this.hashStore.storeRoomIdentification({
8080
creator: details.creator,
8181
roomID: details.room_id,
82-
server: roomIDServerName(details.room_id),
82+
server: userServerName(details.creator),
8383
});
8484
if (isError(storeResult)) {
8585
log.error(

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)