New upstream version 1.5.0
Andrej Shadura
4 years ago
0 | Erik Johnston <erik at matrix.org> | |
1 | * HS core | |
2 | * Federation API impl | |
0 | The following is an incomplete list of people outside the core team who have | |
1 | contributed to Synapse. It is no longer maintained: more recent contributions | |
2 | are listed in the `changelog <CHANGES.md>`_. | |
3 | 3 | |
4 | Mark Haines <mark at matrix.org> | |
5 | * HS core | |
6 | * Crypto | |
7 | * Content repository | |
8 | * CS v2 API impl | |
9 | ||
10 | Kegan Dougal <kegan at matrix.org> | |
11 | * HS core | |
12 | * CS v1 API impl | |
13 | * AS API impl | |
14 | ||
15 | Paul "LeoNerd" Evans <paul at matrix.org> | |
16 | * HS core | |
17 | * Presence | |
18 | * Typing Notifications | |
19 | * Performance metrics and caching layer | |
20 | ||
21 | Dave Baker <dave at matrix.org> | |
22 | * Push notifications | |
23 | * Auth CS v2 impl | |
24 | ||
25 | Matthew Hodgson <matthew at matrix.org> | |
26 | * General doc & housekeeping | |
27 | * Vertobot/vertobridge matrix<->verto PoC | |
28 | ||
29 | Emmanuel Rohee <manu at matrix.org> | |
30 | * Supporting iOS clients (testability and fallback registration) | |
4 | ---- | |
31 | 5 | |
32 | 6 | Turned to Dust <dwinslow86 at gmail.com> |
33 | 7 | * ArchLinux installation instructions |
61 | 35 | * Add LDAP support for authentication |
62 | 36 | |
63 | 37 | Pierre Jaury <pierre at jaury.eu> |
64 | * Docker packaging | |
38 | * Docker packaging | |
65 | 39 | |
66 | 40 | Serban Constantin <serban.constantin at gmail dot com> |
67 | 41 | * Small bug fix |
68 | 42 | |
69 | Jason Robinson <jasonr at matrix.org> | |
70 | * Minor fixes | |
71 | ||
72 | 43 | Joseph Weston <joseph at weston.cloud> |
73 | + Add admin API for querying HS version | |
44 | * Add admin API for querying HS version | |
74 | 45 | |
75 | 46 | Benjamin Saunders <ben.e.saunders at gmail dot com> |
76 | 47 | * Documentation improvements |
0 | Synapse 1.5.0 (2019-10-29) | |
1 | ========================== | |
2 | ||
3 | Security updates | |
4 | ---------------- | |
5 | ||
6 | This release includes a security fix ([\#6262](https://github.com/matrix-org/synapse/issues/6262), below). Administrators are encouraged to upgrade as soon as possible. | |
7 | ||
8 | Bugfixes | |
9 | -------- | |
10 | ||
11 | - Fix bug where room directory search was case sensitive. ([\#6268](https://github.com/matrix-org/synapse/issues/6268)) | |
12 | ||
13 | ||
14 | Synapse 1.5.0rc2 (2019-10-28) | |
15 | ============================= | |
16 | ||
17 | Bugfixes | |
18 | -------- | |
19 | ||
20 | - Update list of boolean columns in `synapse_port_db`. ([\#6247](https://github.com/matrix-org/synapse/issues/6247)) | |
21 | - Fix /keys/query API on workers. ([\#6256](https://github.com/matrix-org/synapse/issues/6256)) | |
22 | - Improve signature checking on some federation APIs. ([\#6262](https://github.com/matrix-org/synapse/issues/6262)) | |
23 | ||
24 | ||
25 | Internal Changes | |
26 | ---------------- | |
27 | ||
28 | - Move schema delta files to the correct data store. ([\#6248](https://github.com/matrix-org/synapse/issues/6248)) | |
29 | - Small performance improvement by removing repeated config lookups in room stats calculation. ([\#6255](https://github.com/matrix-org/synapse/issues/6255)) | |
30 | ||
31 | ||
0 | 32 | Synapse 1.5.0rc1 (2019-10-24) |
1 | 33 | ========================== |
2 | ||
3 | This release includes a database migration step **which may take a long time to complete**: | |
4 | ||
5 | - Allow devices to be marked as hidden, for use by features such as cross-signing. | |
6 | This adds a new field with a default value to the devices field in the database, | |
7 | and so the database upgrade may take a long time depending on how many devices | |
8 | are in the database. ([\#5759](https://github.com/matrix-org/synapse/issues/5759)) | |
9 | 34 | |
10 | 35 | Features |
11 | 36 | -------- |
50 | 75 | ---------------- |
51 | 76 | |
52 | 77 | - Update `user_filters` table to have a unique index, and non-null columns. Thanks to @pik for contributing this. ([\#1172](https://github.com/matrix-org/synapse/issues/1172), [\#6175](https://github.com/matrix-org/synapse/issues/6175), [\#6184](https://github.com/matrix-org/synapse/issues/6184)) |
78 | - Allow devices to be marked as hidden, for use by features such as cross-signing. | |
79 | This adds a new field with a default value to the devices field in the database, | |
80 | and so the database upgrade may take a long time depending on how many devices | |
81 | are in the database. ([\#5759](https://github.com/matrix-org/synapse/issues/5759)) | |
53 | 82 | - Move lookup-related functions from RoomMemberHandler to IdentityHandler. ([\#5978](https://github.com/matrix-org/synapse/issues/5978)) |
54 | 83 | - Improve performance of the public room list directory. ([\#6019](https://github.com/matrix-org/synapse/issues/6019), [\#6152](https://github.com/matrix-org/synapse/issues/6152), [\#6153](https://github.com/matrix-org/synapse/issues/6153), [\#6154](https://github.com/matrix-org/synapse/issues/6154)) |
55 | 84 | - Edit header dicts docstrings in `SimpleHttpClient` to note that `str` or `bytes` can be passed as header keys. ([\#6077](https://github.com/matrix-org/synapse/issues/6077)) |
113 | 113 | debian changelog. (Though typically such changes should be submitted as two |
114 | 114 | separate pull requests.) |
115 | 115 | |
116 | Attribution | |
117 | ~~~~~~~~~~~ | |
118 | ||
119 | Everyone who contributes anything to Matrix is welcome to be listed in the | |
120 | AUTHORS.rst file for the project in question. Please feel free to include a | |
121 | change to AUTHORS.rst in your pull request to list yourself and a short | |
122 | description of the area(s) you've worked on. Also, we sometimes have swag to | |
123 | give away to contributors - if you feel that Matrix-branded apparel is missing | |
124 | from your life, please mail us your shipping address to matrix at matrix.org and | |
125 | we'll try to fix it :) | |
126 | ||
127 | 116 | Sign off |
128 | 117 | ~~~~~~~~ |
129 | 118 |
1 | 1 | ================= |
2 | 2 | |
3 | 3 | Before upgrading check if any special steps are required to upgrade from the |
4 | what you currently have installed to current version of Synapse. The extra | |
4 | version you currently have installed to the current version of Synapse. The extra | |
5 | 5 | instructions that may be required are listed later in this document. |
6 | 6 | |
7 | 7 | * If Synapse was installed using `prebuilt packages |
28 | 28 | running: |
29 | 29 | |
30 | 30 | .. code:: bash |
31 | ||
31 | ||
32 | 32 | git pull |
33 | 33 | pip install --upgrade . |
34 | 34 | |
73 | 73 | # replace `1.3.0` and `stretch` accordingly: |
74 | 74 | wget https://packages.matrix.org/debian/pool/main/m/matrix-synapse-py3/matrix-synapse-py3_1.3.0+stretch1_amd64.deb |
75 | 75 | dpkg -i matrix-synapse-py3_1.3.0+stretch1_amd64.deb |
76 | ||
77 | ||
78 | Upgrading to v1.5.0 | |
79 | =================== | |
80 | ||
81 | This release includes a database migration which may take several minutes to | |
82 | complete if there are a large number (more than a million or so) of entries in | |
83 | the ``devices`` table. This is only likely to a be a problem on very large | |
84 | installations. | |
85 | ||
76 | 86 | |
77 | 87 | Upgrading to v1.4.0 |
78 | 88 | =================== |
0 | matrix-synapse-py3 (1.5.0) stable; urgency=medium | |
1 | ||
2 | * New synapse release 1.5.0. | |
3 | ||
4 | -- Synapse Packaging team <packages@matrix.org> Tue, 29 Oct 2019 14:28:41 +0000 | |
5 | ||
0 | 6 | matrix-synapse-py3 (1.4.1) stable; urgency=medium |
1 | 7 | |
2 | 8 | * New synapse release 1.4.1. |
67 | 67 | "presence_list": ["accepted"], |
68 | 68 | "presence_stream": ["currently_active"], |
69 | 69 | "public_room_list_stream": ["visibility"], |
70 | "devices": ["hidden"], | |
70 | 71 | "device_lists_outbound_pokes": ["sent"], |
71 | 72 | "users_who_share_rooms": ["share_private"], |
72 | 73 | "groups": ["is_public"], |
35 | 35 | except ImportError: |
36 | 36 | pass |
37 | 37 | |
38 | __version__ = "1.5.0rc1" | |
38 | __version__ = "1.5.0" | |
39 | 39 | |
40 | 40 | if bool(os.environ.get("SYNAPSE_TEST_PATCH_LOG_CONTEXTS", False)): |
41 | 41 | # We import here so that we don't have to install a bunch of deps when |
277 | 277 | pdu_to_check.sender_domain, |
278 | 278 | e.getErrorMessage(), |
279 | 279 | ) |
280 | # XX not really sure if these are the right codes, but they are what | |
281 | # we've done for ages | |
282 | raise SynapseError(400, errmsg, Codes.UNAUTHORIZED) | |
280 | raise SynapseError(403, errmsg, Codes.FORBIDDEN) | |
283 | 281 | |
284 | 282 | for p, d in zip(pdus_to_check_sender, more_deferreds): |
285 | 283 | d.addErrback(sender_err, p) |
313 | 311 | "event id %s: unable to verify signature for event id domain: %s" |
314 | 312 | % (pdu_to_check.pdu.event_id, e.getErrorMessage()) |
315 | 313 | ) |
316 | # XX as above: not really sure if these are the right codes | |
317 | raise SynapseError(400, errmsg, Codes.UNAUTHORIZED) | |
314 | raise SynapseError(403, errmsg, Codes.FORBIDDEN) | |
318 | 315 | |
319 | 316 | for p, d in zip(pdus_to_check_event_id, more_deferreds): |
320 | 317 | d.addErrback(event_err, p) |
369 | 369 | pdu = event_from_pdu_json(content, format_ver) |
370 | 370 | origin_host, _ = parse_server_name(origin) |
371 | 371 | yield self.check_server_matches_acl(origin_host, pdu.room_id) |
372 | pdu = yield self._check_sigs_and_hash(room_version, pdu) | |
372 | 373 | ret_pdu = yield self.handler.on_invite_request(origin, pdu) |
373 | 374 | time_now = self._clock.time_msec() |
374 | 375 | return {"event": ret_pdu.get_pdu_json(time_now)} |
385 | 386 | yield self.check_server_matches_acl(origin_host, pdu.room_id) |
386 | 387 | |
387 | 388 | logger.debug("on_send_join_request: pdu sigs: %s", pdu.signatures) |
389 | ||
390 | pdu = yield self._check_sigs_and_hash(room_version, pdu) | |
391 | ||
388 | 392 | res_pdus = yield self.handler.on_send_join_request(origin, pdu) |
389 | 393 | time_now = self._clock.time_msec() |
390 | 394 | return ( |
420 | 424 | yield self.check_server_matches_acl(origin_host, pdu.room_id) |
421 | 425 | |
422 | 426 | logger.debug("on_send_leave_request: pdu sigs: %s", pdu.signatures) |
427 | ||
428 | pdu = yield self._check_sigs_and_hash(room_version, pdu) | |
429 | ||
423 | 430 | yield self.handler.on_send_leave_request(origin, pdu) |
424 | 431 | return 200, {} |
425 | 432 |
1221 | 1221 | Returns: |
1222 | 1222 | Deferred[FrozenEvent] |
1223 | 1223 | """ |
1224 | ||
1225 | 1224 | if get_domain_from_id(user_id) != origin: |
1226 | 1225 | logger.info( |
1227 | 1226 | "Got /make_join request for user %r from different origin %s, ignoring", |
1279 | 1278 | event = pdu |
1280 | 1279 | |
1281 | 1280 | logger.debug( |
1282 | "on_send_join_request: Got event: %s, signatures: %s", | |
1281 | "on_send_join_request from %s: Got event: %s, signatures: %s", | |
1282 | origin, | |
1283 | 1283 | event.event_id, |
1284 | 1284 | event.signatures, |
1285 | 1285 | ) |
1286 | ||
1287 | if get_domain_from_id(event.sender) != origin: | |
1288 | logger.info( | |
1289 | "Got /send_join request for user %r from different origin %s", | |
1290 | event.sender, | |
1291 | origin, | |
1292 | ) | |
1293 | raise SynapseError(403, "User not from origin", Codes.FORBIDDEN) | |
1286 | 1294 | |
1287 | 1295 | event.internal_metadata.outlier = False |
1288 | 1296 | # Send this event on behalf of the origin server. |
1501 | 1509 | event.event_id, |
1502 | 1510 | event.signatures, |
1503 | 1511 | ) |
1512 | ||
1513 | if get_domain_from_id(event.sender) != origin: | |
1514 | logger.info( | |
1515 | "Got /send_leave request for user %r from different origin %s", | |
1516 | event.sender, | |
1517 | origin, | |
1518 | ) | |
1519 | raise SynapseError(403, "User not from origin", Codes.FORBIDDEN) | |
1504 | 1520 | |
1505 | 1521 | event.internal_metadata.outlier = False |
1506 | 1522 |
44 | 44 | self.is_mine_id = hs.is_mine_id |
45 | 45 | self.stats_bucket_size = hs.config.stats_bucket_size |
46 | 46 | |
47 | self.stats_enabled = hs.config.stats_enabled | |
48 | ||
47 | 49 | # The current position in the current_state_delta stream |
48 | 50 | self.pos = None |
49 | 51 | |
60 | 62 | def notify_new_event(self): |
61 | 63 | """Called when there may be more deltas to process |
62 | 64 | """ |
63 | if not self.hs.config.stats_enabled or self._is_processing: | |
65 | if not self.stats_enabled or self._is_processing: | |
64 | 66 | return |
65 | 67 | |
66 | 68 | self._is_processing = True |
246 | 246 | return result |
247 | 247 | |
248 | 248 | return self.runInteraction("count_e2e_one_time_keys", _count_e2e_one_time_keys) |
249 | ||
250 | def _get_e2e_cross_signing_key_txn(self, txn, user_id, key_type, from_user_id=None): | |
251 | """Returns a user's cross-signing key. | |
252 | ||
253 | Args: | |
254 | txn (twisted.enterprise.adbapi.Connection): db connection | |
255 | user_id (str): the user whose key is being requested | |
256 | key_type (str): the type of key that is being set: either 'master' | |
257 | for a master key, 'self_signing' for a self-signing key, or | |
258 | 'user_signing' for a user-signing key | |
259 | from_user_id (str): if specified, signatures made by this user on | |
260 | the key will be included in the result | |
261 | ||
262 | Returns: | |
263 | dict of the key data or None if not found | |
264 | """ | |
265 | sql = ( | |
266 | "SELECT keydata " | |
267 | " FROM e2e_cross_signing_keys " | |
268 | " WHERE user_id = ? AND keytype = ? ORDER BY stream_id DESC LIMIT 1" | |
269 | ) | |
270 | txn.execute(sql, (user_id, key_type)) | |
271 | row = txn.fetchone() | |
272 | if not row: | |
273 | return None | |
274 | key = json.loads(row[0]) | |
275 | ||
276 | device_id = None | |
277 | for k in key["keys"].values(): | |
278 | device_id = k | |
279 | ||
280 | if from_user_id is not None: | |
281 | sql = ( | |
282 | "SELECT key_id, signature " | |
283 | " FROM e2e_cross_signing_signatures " | |
284 | " WHERE user_id = ? " | |
285 | " AND target_user_id = ? " | |
286 | " AND target_device_id = ? " | |
287 | ) | |
288 | txn.execute(sql, (from_user_id, user_id, device_id)) | |
289 | row = txn.fetchone() | |
290 | if row: | |
291 | key.setdefault("signatures", {}).setdefault(from_user_id, {})[ | |
292 | row[0] | |
293 | ] = row[1] | |
294 | ||
295 | return key | |
296 | ||
297 | def get_e2e_cross_signing_key(self, user_id, key_type, from_user_id=None): | |
298 | """Returns a user's cross-signing key. | |
299 | ||
300 | Args: | |
301 | user_id (str): the user whose self-signing key is being requested | |
302 | key_type (str): the type of cross-signing key to get | |
303 | from_user_id (str): if specified, signatures made by this user on | |
304 | the self-signing key will be included in the result | |
305 | ||
306 | Returns: | |
307 | dict of the key data or None if not found | |
308 | """ | |
309 | return self.runInteraction( | |
310 | "get_e2e_cross_signing_key", | |
311 | self._get_e2e_cross_signing_key_txn, | |
312 | user_id, | |
313 | key_type, | |
314 | from_user_id, | |
315 | ) | |
249 | 316 | |
250 | 317 | |
251 | 318 | class EndToEndKeyStore(EndToEndKeyWorkerStore, SQLBaseStore): |
425 | 492 | key, |
426 | 493 | ) |
427 | 494 | |
428 | def _get_e2e_cross_signing_key_txn(self, txn, user_id, key_type, from_user_id=None): | |
429 | """Returns a user's cross-signing key. | |
430 | ||
431 | Args: | |
432 | txn (twisted.enterprise.adbapi.Connection): db connection | |
433 | user_id (str): the user whose key is being requested | |
434 | key_type (str): the type of key that is being set: either 'master' | |
435 | for a master key, 'self_signing' for a self-signing key, or | |
436 | 'user_signing' for a user-signing key | |
437 | from_user_id (str): if specified, signatures made by this user on | |
438 | the key will be included in the result | |
439 | ||
440 | Returns: | |
441 | dict of the key data or None if not found | |
442 | """ | |
443 | sql = ( | |
444 | "SELECT keydata " | |
445 | " FROM e2e_cross_signing_keys " | |
446 | " WHERE user_id = ? AND keytype = ? ORDER BY stream_id DESC LIMIT 1" | |
447 | ) | |
448 | txn.execute(sql, (user_id, key_type)) | |
449 | row = txn.fetchone() | |
450 | if not row: | |
451 | return None | |
452 | key = json.loads(row[0]) | |
453 | ||
454 | device_id = None | |
455 | for k in key["keys"].values(): | |
456 | device_id = k | |
457 | ||
458 | if from_user_id is not None: | |
459 | sql = ( | |
460 | "SELECT key_id, signature " | |
461 | " FROM e2e_cross_signing_signatures " | |
462 | " WHERE user_id = ? " | |
463 | " AND target_user_id = ? " | |
464 | " AND target_device_id = ? " | |
465 | ) | |
466 | txn.execute(sql, (from_user_id, user_id, device_id)) | |
467 | row = txn.fetchone() | |
468 | if row: | |
469 | key.setdefault("signatures", {}).setdefault(from_user_id, {})[ | |
470 | row[0] | |
471 | ] = row[1] | |
472 | ||
473 | return key | |
474 | ||
475 | def get_e2e_cross_signing_key(self, user_id, key_type, from_user_id=None): | |
476 | """Returns a user's cross-signing key. | |
477 | ||
478 | Args: | |
479 | user_id (str): the user whose self-signing key is being requested | |
480 | key_type (str): the type of cross-signing key to get | |
481 | from_user_id (str): if specified, signatures made by this user on | |
482 | the self-signing key will be included in the result | |
483 | ||
484 | Returns: | |
485 | dict of the key data or None if not found | |
486 | """ | |
487 | return self.runInteraction( | |
488 | "get_e2e_cross_signing_key", | |
489 | self._get_e2e_cross_signing_key_txn, | |
490 | user_id, | |
491 | key_type, | |
492 | from_user_id, | |
493 | ) | |
494 | ||
495 | 495 | def store_e2e_cross_signing_signatures(self, user_id, signatures): |
496 | 496 | """Stores cross-signing signatures. |
497 | 497 |
200 | 200 | where_clauses.append( |
201 | 201 | """ |
202 | 202 | ( |
203 | name LIKE ? | |
204 | OR topic LIKE ? | |
205 | OR canonical_alias LIKE ? | |
203 | LOWER(name) LIKE ? | |
204 | OR LOWER(topic) LIKE ? | |
205 | OR LOWER(canonical_alias) LIKE ? | |
206 | 206 | ) |
207 | 207 | """ |
208 | 208 | ) |
209 | query_args += [search_term, search_term, search_term] | |
209 | query_args += [ | |
210 | search_term.lower(), | |
211 | search_term.lower(), | |
212 | search_term.lower(), | |
213 | ] | |
210 | 214 | |
211 | 215 | where_clause = "" |
212 | 216 | if where_clauses: |
0 | /* Copyright 2019 New Vector Ltd | |
1 | * | |
2 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
3 | * you may not use this file except in compliance with the License. | |
4 | * You may obtain a copy of the License at | |
5 | * | |
6 | * http://www.apache.org/licenses/LICENSE-2.0 | |
7 | * | |
8 | * Unless required by applicable law or agreed to in writing, software | |
9 | * distributed under the License is distributed on an "AS IS" BASIS, | |
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
11 | * See the License for the specific language governing permissions and | |
12 | * limitations under the License. | |
13 | */ | |
14 | ||
15 | -- device list needs to know which ones are "real" devices, and which ones are | |
16 | -- just used to avoid collisions | |
17 | ALTER TABLE devices ADD COLUMN hidden BOOLEAN DEFAULT FALSE; |
0 | /* Copyright 2019 New Vector Ltd | |
1 | * | |
2 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
3 | * you may not use this file except in compliance with the License. | |
4 | * You may obtain a copy of the License at | |
5 | * | |
6 | * http://www.apache.org/licenses/LICENSE-2.0 | |
7 | * | |
8 | * Unless required by applicable law or agreed to in writing, software | |
9 | * distributed under the License is distributed on an "AS IS" BASIS, | |
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
11 | * See the License for the specific language governing permissions and | |
12 | * limitations under the License. | |
13 | */ | |
14 | ||
15 | -- cross-signing keys | |
16 | CREATE TABLE IF NOT EXISTS e2e_cross_signing_keys ( | |
17 | user_id TEXT NOT NULL, | |
18 | -- the type of cross-signing key (master, user_signing, or self_signing) | |
19 | keytype TEXT NOT NULL, | |
20 | -- the full key information, as a json-encoded dict | |
21 | keydata TEXT NOT NULL, | |
22 | -- for keeping the keys in order, so that we can fetch the latest one | |
23 | stream_id BIGINT NOT NULL | |
24 | ); | |
25 | ||
26 | CREATE UNIQUE INDEX e2e_cross_signing_keys_idx ON e2e_cross_signing_keys(user_id, keytype, stream_id); | |
27 | ||
28 | -- cross-signing signatures | |
29 | CREATE TABLE IF NOT EXISTS e2e_cross_signing_signatures ( | |
30 | -- user who did the signing | |
31 | user_id TEXT NOT NULL, | |
32 | -- key used to sign | |
33 | key_id TEXT NOT NULL, | |
34 | -- user who was signed | |
35 | target_user_id TEXT NOT NULL, | |
36 | -- device/key that was signed | |
37 | target_device_id TEXT NOT NULL, | |
38 | -- the actual signature | |
39 | signature TEXT NOT NULL | |
40 | ); | |
41 | ||
42 | CREATE UNIQUE INDEX e2e_cross_signing_signatures_idx ON e2e_cross_signing_signatures(user_id, target_user_id, target_device_id); | |
43 | ||
44 | -- stream of user signature updates | |
45 | CREATE TABLE IF NOT EXISTS user_signature_stream ( | |
46 | -- uses the same stream ID as device list stream | |
47 | stream_id BIGINT NOT NULL, | |
48 | -- user who did the signing | |
49 | from_user_id TEXT NOT NULL, | |
50 | -- list of users who were signed, as a JSON array | |
51 | user_ids TEXT NOT NULL | |
52 | ); | |
53 | ||
54 | CREATE UNIQUE INDEX user_signature_stream_idx ON user_signature_stream(stream_id); |
0 | /* Copyright 2019 New Vector Ltd | |
1 | * | |
2 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
3 | * you may not use this file except in compliance with the License. | |
4 | * You may obtain a copy of the License at | |
5 | * | |
6 | * http://www.apache.org/licenses/LICENSE-2.0 | |
7 | * | |
8 | * Unless required by applicable law or agreed to in writing, software | |
9 | * distributed under the License is distributed on an "AS IS" BASIS, | |
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
11 | * See the License for the specific language governing permissions and | |
12 | * limitations under the License. | |
13 | */ | |
14 | ||
15 | -- device list needs to know which ones are "real" devices, and which ones are | |
16 | -- just used to avoid collisions | |
17 | ALTER TABLE devices ADD COLUMN hidden BOOLEAN DEFAULT FALSE; |
0 | /* Copyright 2019 New Vector Ltd | |
1 | * | |
2 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
3 | * you may not use this file except in compliance with the License. | |
4 | * You may obtain a copy of the License at | |
5 | * | |
6 | * http://www.apache.org/licenses/LICENSE-2.0 | |
7 | * | |
8 | * Unless required by applicable law or agreed to in writing, software | |
9 | * distributed under the License is distributed on an "AS IS" BASIS, | |
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
11 | * See the License for the specific language governing permissions and | |
12 | * limitations under the License. | |
13 | */ | |
14 | ||
15 | -- cross-signing keys | |
16 | CREATE TABLE IF NOT EXISTS e2e_cross_signing_keys ( | |
17 | user_id TEXT NOT NULL, | |
18 | -- the type of cross-signing key (master, user_signing, or self_signing) | |
19 | keytype TEXT NOT NULL, | |
20 | -- the full key information, as a json-encoded dict | |
21 | keydata TEXT NOT NULL, | |
22 | -- for keeping the keys in order, so that we can fetch the latest one | |
23 | stream_id BIGINT NOT NULL | |
24 | ); | |
25 | ||
26 | CREATE UNIQUE INDEX e2e_cross_signing_keys_idx ON e2e_cross_signing_keys(user_id, keytype, stream_id); | |
27 | ||
28 | -- cross-signing signatures | |
29 | CREATE TABLE IF NOT EXISTS e2e_cross_signing_signatures ( | |
30 | -- user who did the signing | |
31 | user_id TEXT NOT NULL, | |
32 | -- key used to sign | |
33 | key_id TEXT NOT NULL, | |
34 | -- user who was signed | |
35 | target_user_id TEXT NOT NULL, | |
36 | -- device/key that was signed | |
37 | target_device_id TEXT NOT NULL, | |
38 | -- the actual signature | |
39 | signature TEXT NOT NULL | |
40 | ); | |
41 | ||
42 | CREATE UNIQUE INDEX e2e_cross_signing_signatures_idx ON e2e_cross_signing_signatures(user_id, target_user_id, target_device_id); | |
43 | ||
44 | -- stream of user signature updates | |
45 | CREATE TABLE IF NOT EXISTS user_signature_stream ( | |
46 | -- uses the same stream ID as device list stream | |
47 | stream_id BIGINT NOT NULL, | |
48 | -- user who did the signing | |
49 | from_user_id TEXT NOT NULL, | |
50 | -- list of users who were signed, as a JSON array | |
51 | user_ids TEXT NOT NULL | |
52 | ); | |
53 | ||
54 | CREATE UNIQUE INDEX user_signature_stream_idx ON user_signature_stream(stream_id); |
606 | 606 | """ |
607 | 607 | |
608 | 608 | self.hs.config.stats_enabled = False |
609 | self.handler.stats_enabled = False | |
609 | 610 | |
610 | 611 | u1 = self.register_user("u1", "pass") |
611 | 612 | u1token = self.login("u1", "pass") |
617 | 618 | self.assertIsNone(self._get_current_stats("user", u1)) |
618 | 619 | |
619 | 620 | self.hs.config.stats_enabled = True |
621 | self.handler.stats_enabled = True | |
620 | 622 | |
621 | 623 | self._perform_background_initial_update() |
622 | 624 |
113 | 113 | basepython = python3.6 |
114 | 114 | deps = |
115 | 115 | flake8 |
116 | black | |
116 | black==19.3b0 # We pin so that our tests don't start failing on new releases of black. | |
117 | 117 | commands = |
118 | 118 | python -m black --check --diff . |
119 | 119 | /bin/sh -c "flake8 synapse tests scripts scripts-dev scripts/hash_password scripts/register_new_matrix_user scripts/synapse_port_db synctl {env:PEP8SUFFIX:}" |