summary refs log tree commit diff
path: root/tests/crypto (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Revert accidental fast-forward merge from v1.49.0rc1"Olivier Wilkinson (reivilibre)2021-12-141-0/+71
| | | | This reverts commit 158d73ebdd61eef33831ae5f6990acf07244fc55.
* Revert accidental fast-forward merge from v1.49.0rc1Sean Quah2021-12-071-71/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Revert "Sort internal changes in changelog" Revert "Update CHANGES.md" Revert "1.49.0rc1" Revert "Revert "Move `glob_to_regex` and `re_word_boundary` to `matrix-python-common` (#11505) (#11527)" Revert "Refactors in `_generate_sync_entry_for_rooms` (#11515)" Revert "Correctly register shutdown handler for presence workers (#11518)" Revert "Fix `ModuleApi.looping_background_call` for non-async functions (#11524)" Revert "Fix 'delete room' admin api to work on incomplete rooms (#11523)" Revert "Correctly ignore invites from ignored users (#11511)" Revert "Fix the test breakage introduced by #11435 as a result of concurrent PRs (#11522)" Revert "Stabilise support for MSC2918 refresh tokens as they have now been merged into the Matrix specification. (#11435)" Revert "Save the OIDC session ID (sid) with the device on login (#11482)" Revert "Add admin API to get some information about federation status (#11407)" Revert "Include bundled aggregations in /sync and related fixes (#11478)" Revert "Move `glob_to_regex` and `re_word_boundary` to `matrix-python-common` (#11505)" Revert "Update backward extremity docs to make it clear that it does not indicate whether we have fetched an events' `prev_events` (#11469)" Revert "Support configuring the lifetime of non-refreshable access tokens separately to refreshable access tokens. (#11445)" Revert "Add type hints to `synapse/tests/rest/admin` (#11501)" Revert "Revert accidental commits to develop." Revert "Newsfile" Revert "Give `tests.server.setup_test_homeserver` (nominally!) the same behaviour" Revert "Move `tests.utils.setup_test_homeserver` to `tests.server`" Revert "Convert one of the `setup_test_homeserver`s to `make_test_homeserver_synchronous`" Revert "Disambiguate queries on `state_key` (#11497)" Revert "Comments on the /sync tentacles (#11494)" Revert "Clean up tests.storage.test_appservice (#11492)" Revert "Clean up `tests.storage.test_main` to remove use of legacy code. (#11493)" Revert "Clean up `tests.test_visibility` to remove legacy code. (#11495)" Revert "Minor cleanup on recently ported doc pages (#11466)" Revert "Add most of the missing type hints to `synapse.federation`. (#11483)" Revert "Avoid waiting for zombie processes in `synctl stop` (#11490)" Revert "Fix media repository failing when media store path contains symlinks (#11446)" Revert "Add type annotations to `tests.storage.test_appservice`. (#11488)" Revert "`scripts-dev/sign_json`: support for signing events (#11486)" Revert "Add MSC3030 experimental client and federation API endpoints to get the closest event to a given timestamp (#9445)" Revert "Port wiki pages to documentation website (#11402)" Revert "Add a license header and comment. (#11479)" Revert "Clean-up get_version_string (#11468)" Revert "Link background update controller docs to summary (#11475)" Revert "Additional type hints for config module. (#11465)" Revert "Register the login redirect endpoint for v3. (#11451)" Revert "Update openid.md" Revert "Remove mention of OIDC certification from Dex (#11470)" Revert "Add a note about huge pages to our Postgres doc (#11467)" Revert "Don't start Synapse master process if `worker_app` is set (#11416)" Revert "Expose worker & homeserver as entrypoints in `setup.py` (#11449)" Revert "Bundle relations of relations into the `/relations` result. (#11284)" Revert "Fix `LruCache` corruption bug with a `size_callback` that can return 0 (#11454)" Revert "Eliminate a few `Any`s in `LruCache` type hints (#11453)" Revert "Remove unnecessary `json.dumps` from `tests.rest.admin` (#11461)" Revert "Merge branch 'master' into develop" This reverts commit 26b5d2320f62b5eb6262c7614fbdfc364a4dfc02. This reverts commit bce4220f387bf5448387f0ed7d14ed1e41e40747. This reverts commit 966b5d0fa0893c3b628c942dfc232e285417f46d. This reverts commit 088d748f2cb51f03f3bcacc0fb3af1e0f9607737. This reverts commit 14d593f72d10b4d8cb67e3288bb3131ee30ccf59. This reverts commit 2a3ec6facf79f6aae011d9fb6f9ed5e43c7b6bec. This reverts commit eccc49d7554d1fab001e1fefb0fda8ffb254b630. This reverts commit b1ecd19c5d19815b69e425d80f442bf2877cab76. This reverts commit 9c55dedc8c4484e6269451a8c3c10b3e314aeb4a. This reverts commit 2d42e586a8c54be1a83643148358b1651c1ca666. This reverts commit 2f053f3f82ca174cc1c858c75afffae51af8ce0d. This reverts commit a15a893df8428395df7cb95b729431575001c38a. This reverts commit 8b4b153c9e86c04c7db8c74fde4b6a04becbc461. This reverts commit 494ebd7347ba52d702802fba4c3bb13e7bfbc2cf. This reverts commit a77c36989785c0d5565ab9a1169f4f88e512ce8a. This reverts commit 4eb77965cd016181d2111f37d93526e9bb0434f0. This reverts commit 637df95de63196033a6da4a6e286e1d58ea517b6. This reverts commit e5f426cd54609e7f05f8241d845e6e36c5f10d9a. This reverts commit 8cd68b8102eeab1b525712097c1b2e9679c11896. This reverts commit 6cae125e20865c52d770b24278bb7ab8fde5bc0d. This reverts commit 7be88fbf48156b36b6daefb228e1258e7d48cae4. This reverts commit b3fd99b74a3f6f42a9afd1b19ee4c60e38e8e91a. This reverts commit f7ec6e7d9e0dc360d9fb41f3a1afd7bdba1475c7. This reverts commit 5640992d176a499204a0756b1677c9b1575b0a49. This reverts commit d26808dd854006bd26a2366c675428ce0737238c. This reverts commit f91624a5950e14ba9007eed9bfa1c828676d4745. This reverts commit 16d39a5490ce74c901c7a8dbb990c6e83c379207. This reverts commit 8a4c2969874c0b7d72003f2523883eba8a348e83. This reverts commit 49e1356ee3d5d72929c91f778b3a231726c1413c. This reverts commit d2279f471ba8f44d9f578e62b286897a338d8aa1. This reverts commit b50e39df578adc3f86c5efa16bee9035cfdab61b. This reverts commit 858d80bf0f9f656a03992794874081b806e49222. This reverts commit 435f04480728c5d982e1a63c1b2777784bf9cd26. This reverts commit f61462e1be36a51dbf571076afa8e1930cb182f4. This reverts commit a6f1a3abecf8e8fd3e1bff439a06b853df18f194. This reverts commit 84dc50e160a2ec6590813374b5a1e58b97f7a18d. This reverts commit ed635d32853ee0a3e5ec1078679b27e7844a4ac7. This reverts commit 7b62791e001d6a4f8897ed48b3232d7f8fe6aa48. This reverts commit 153194c7717d8016b0eb974c81b1baee7dc1917d. This reverts commit f44d729d4ccae61bc0cdd5774acb3233eb5f7c13. This reverts commit a265fbd397ae72b2d3ea4c9310591ff1d0f3e05c. This reverts commit b9fef1a7cdfcc128fa589a32160e6aa7ed8964d7. This reverts commit b0eb64ff7bf6bde42046e091f8bdea9b7aab5f04. This reverts commit f1795463bf503a6fca909d77f598f641f9349f56. This reverts commit 70cbb1a5e311f609b624e3fae1a1712db639c51e. This reverts commit 42bf0204635213e2c75188b19ee66dc7e7d8a35e. This reverts commit 379f2650cf875f50c59524147ec0e33cfd5ef60c. This reverts commit 7ff22d6da41cd5ca80db95c18b409aea38e49fcd. This reverts commit 5a0b652d36ae4b6d423498c1f2c82c97a49c6f75. This reverts commit 432a174bc192740ac7a0a755009f6099b8363ad9. This reverts commit b14f8a1baf6f500997ae4c1d6a6d72094ce14270, reversing changes made to e713855dca17a7605bae99ea8d71bc7f8657e4b8.
* Fix perspectives requests for multiple keys for the same server (#11440)Richard van der Hoff2021-11-291-0/+71
| | | | | If we tried to request multiple keys for the same server, we would end up dropping some of those requests.
* Fix verification of objects signed with old local keys (#11379)Richard van der Hoff2021-11-191-3/+53
| | | | | | | Fixes a bug introduced in #11129: objects signed by the local server, but with keys other than the current one, could not be successfully verified. We need to check the key id in the signature, and track down the right key.
* Fetch verify key locally rather than trying to do so over federation if ↵Shay2021-10-281-0/+12
| | | | | | | | | | | | | | | | | | | | | | | origin and host are the same. (#11129) * add tests for fetching key locally * add logic to check if origin server is same as host and fetch verify key locally rather than over federation * add changelog * slight refactor, add docstring, change changelog entry * Make changelog entry one line * remove verify_json_locally and push locality check to process_request, add function process_request_locally * remove leftover code reference * refactor to add common call to 'verify_json and associated handling code * add type hint to process_json * add some docstrings + very slight refactor
* Rewrite the KeyRing (#10035)Erik Johnston2021-06-021-84/+86
|
* Remove redundant "coding: utf-8" lines (#9786)Jonathan de Jong2021-04-143-3/+0
| | | | | | | Part of #9744 Removes all redundant `# -*- coding: utf-8 -*-` lines from files, as python 3 automatically reads source code as utf-8 now. `Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>`
* Use mock from the stdlib. (#9772)Patrick Cloke2021-04-091-2/+1
|
* Record more information into structured logs. (#9654)Patrick Cloke2021-04-081-12/+11
| | | | Records additional request information into the structured logs, e.g. the requester, IP address, etc.
* Update black, and run auto formatting over the codebase (#9381)Eric Eastwood2021-02-161-2/+7
| | | | | | | - Update black version to the latest - Run black auto formatting over the codebase - Run autoformatting according to [`docs/code_style.md `](https://github.com/matrix-org/synapse/blob/80d6dc9783aa80886a133756028984dbf8920168/docs/code_style.md) - Update `code_style.md` docs around installing black to use the correct version
* Add type hints to the crypto module. (#8999)Patrick Cloke2021-01-041-5/+5
|
* Apply an IP range blacklist to push and key revocation requests. (#8821)Patrick Cloke2020-12-021-2/+4
| | | | | | | | | | | | Replaces the `federation_ip_range_blacklist` configuration setting with an `ip_range_blacklist` setting with wider scope. It now applies to: * Federation * Identity servers * Push notifications * Checking key validitity for third-party invite events The old `federation_ip_range_blacklist` setting is still honored if present, but with reduced scope (it only applies to federation and identity servers).
* Remove the deprecated Handlers object (#8494)Patrick Cloke2020-10-091-4/+2
| | | All handlers now available via get_*_handler() methods on the HomeServer.
* Create a mechanism for marking tests "logcontext clean" (#8399)Richard van der Hoff2020-09-281-0/+3
|
* Fix occasional "Re-starting finished log context" from keyring (#8398)Richard van der Hoff2020-09-251-64/+56
| | | | | | | | | | | | | | | * Fix test_verify_json_objects_for_server_awaits_previous_requests It turns out that this wasn't really testing what it thought it was testing (in particular, `check_context` was turning failures into success, which was making the tests pass even though it wasn't clear they should have been. It was also somewhat overcomplex - we can test what it was trying to test without mocking out perspectives servers. * Fix warnings about finished logcontexts in the keyring We need to make sure that we finish the key fetching magic before we run the verifying code, to ensure that we don't mess up our logcontexts.
* Stop sub-classing object (#8249)Patrick Cloke2020-09-041-1/+1
|
* Do not yield on awaitables in tests. (#8193)Patrick Cloke2020-08-271-2/+2
|
* Convert the crypto module to async/await. (#8003)Patrick Cloke2020-08-031-23/+16
|
* Convert federation client to async/await. (#7975)Patrick Cloke2020-07-301-7/+4
|
* Fix some spelling mistakes / typos. (#7811)Patrick Cloke2020-07-091-1/+1
|
* Clean up some LoggingContext stuff (#7120)Richard van der Hoff2020-03-241-4/+3
| | | | | | | | | | | | | | | | | | | | | | | * Pull Sentinel out of LoggingContext ... and drop a few unnecessary references to it * Factor out LoggingContext.current_context move `current_context` and `set_context` out to top-level functions. Mostly this means that I can more easily trace what's actually referring to LoggingContext, but I think it's generally neater. * move copy-to-parent into `stop` this really just makes `start` and `stop` more symetric. It also means that it behaves correctly if you manually `set_log_context` rather than using the context manager. * Replace `LoggingContext.alive` with `finished` Turn `alive` into `finished` and make it a bit better defined.
* Add a `make_event_from_dict` method (#6858)Richard van der Hoff2020-02-071-3/+3
| | | | | | | ... and use it in places where it's trivial to do so. This will make it easier to pass room versions into the FrozenEvent constructors.
* Pass room_version into add_hashes_and_signaturesRichard van der Hoff2020-01-301-2/+7
|
* Fix exception when fetching notary server's old keys (#6625)Richard van der Hoff2020-01-061-44/+95
| | | | | | Lift the restriction that *all* the keys used for signing v2 key responses be present in verify_keys. Fixes #6596.
* Review commentsErik Johnston2019-10-301-2/+2
|
* Replace returnValue with return (#5736)Amber Brown2019-07-231-3/+3
|
* Refactor Keyring._start_key_lookupsRichard van der Hoff2019-07-191-29/+0
| | | | | There's an awful lot of deferreds and dictionaries flying around here. The whole thing can be made much simpler and achieve the same effect.
* Move logging utilities out of the side drawer of util/ and into logging/ (#5606)Amber Brown2019-07-041-5/+8
|
* Run Black. (#5482)Amber Brown2019-06-201-23/+23
|
* Fix key verification when key stored with null valid_until_msErik Johnston2019-06-101-1/+49
| | | | | | | | | | Some keys are stored in the synapse database with a null valid_until_ms which caused an exception to be thrown when using that key. We fix this by treating nulls as zeroes, i.e. they keys will match verification requests with a minimum_valid_until_ms of zero (i.e. don't validate ts) but will not match requests with a non-zero minimum_valid_until_ms. Fixes #5391.
* Stop hardcoding trust of old matrix.org key (#5374)Richard van der Hoff2019-06-061-15/+28
| | | | | | | | | | | | | | | | | There are a few changes going on here: * We make checking the signature on a key server response optional: if no verify_keys are specified, we trust to TLS to validate the connection. * We change the default config so that it does not require responses to be signed by the old key. * We replace the old 'perspectives' config with 'trusted_key_servers', which is also formatted slightly differently. * We emit a warning to the logs every time we trust a key server response signed by the old key.
* Associate a request_name with each verify request, for loggingRichard van der Hoff2019-06-051-10/+8
| | | | | | | Also: * rename VerifyKeyRequest->VerifyJsonRequest * calculate key_ids on VerifyJsonRequest construction * refactor things to pass around VerifyJsonRequests instead of 4-tuples
* Don't bomb out on direct key fetches as soon as one failsRichard van der Hoff2019-06-041-7/+5
|
* Enforce validity period on server_keys for fed requests. (#5321)Richard van der Hoff2019-06-031-27/+108
| | | | | | | | When handling incoming federation requests, make sure that we have an up-to-date copy of the signing key. We do not yet enforce the validity period for event signatures.
* Merge pull request #5251 from matrix-org/rav/server_keys/01-check_sigRichard van der Hoff2019-05-281-9/+75
|\ | | | | Ensure that server_keys fetched via a notary server are correctly signed.
| * Require sig from origin server on perspectives responsesRichard van der Hoff2019-05-231-9/+75
| |
* | Simplification to Keyring.wait_for_previous_lookups. (#5250)Richard van der Hoff2019-05-241-2/+2
|/ | | | | | The list of server names was redundant, since it was equivalent to the keys on the server_to_deferred map. This reduces the number of large lists being passed around, and has the benefit of deduplicating the entries in `wait_on`.
* Factor out KeyFetchers from KeyRingRichard van der Hoff2019-05-231-6/+28
| | | | | | | Rather than have three methods which have to have the same interface, factor out a separate interface which is provided by three implementations. I find it easier to grok the code this way.
* Store key validity time in the storage layerRichard van der Hoff2019-05-231-8/+14
| | | | | | | | This is a first step to checking that the key is valid at the required moment. The idea here is that, rather than passing VerifyKey objects in and out of the storage layer, we instead pass FetchKeyResult objects, which simply wrap the VerifyKey and add a valid_until_ts field.
* Rewrite store_server_verify_key to store several keys at once (#5234)Richard van der Hoff2019-05-231-2/+12
| | | | | Storing server keys hammered the database a bit. This replaces the implementation which stored a single key, with one which can do many updates at once.
* Run Black on the tests again (#5170)Amber Brown2019-05-101-1/+2
|
* Remove periods from copyright headers (#5046)Andrew Morgan2019-04-111-1/+1
|
* Fix from_server buglet in get_keys_from_perspectivesRichard van der Hoff2019-04-081-0/+1
| | | | | make sure we store the name of the server the keys came from, rather than the origin server, after doing a fetch-from-perspectives.
* test for get_keys_from_perspectivesRichard van der Hoff2019-04-041-0/+67
|
* add a test for get_keys_from_serverRichard van der Hoff2019-04-041-0/+63
|
* Rewrite KeyringTestCase as a HomeServerTestCase (#4986)Richard van der Hoff2019-04-031-107/+104
| | | | | This is a bit fiddly due to the keyring doing weird things with logcontexts.
* Make add_hashes_and_signatures operate on dictsErik Johnston2019-01-291-30/+26
|
* Check logcontexts before and after each test (#4190)Richard van der Hoff2018-11-271-6/+12
| | | | | | | | | | | | * Add better diagnostics to flakey keyring test * fix interpolation fail * Check logcontexts before and after each test * update changelog * update changelog
* Run tests under PostgreSQL (#3423)Amber Brown2018-08-131-4/+2
|
* fix up a forced long lineAmber Brown2018-08-111-1/+2
|
* Run black.black2018-08-102-43/+22
|
* run isortAmber Brown2018-07-092-9/+11
|
* Pass around the reactor explicitly (#3385)Amber Brown2018-06-221-4/+5
|
* Make tests py3 compatibleAdrian Tschira2018-04-161-1/+1
| | | | | | | | | | | This is a mixed commit that fixes various small issues * print parentheses * 01 is invalid syntax (it was octal in py2) * [x for i in 1, 2] is invalid syntax * six moves Signed-off-by: Adrian Tschira <nota@notafile.com>
* Create dbpool as normal in testsRichard van der Hoff2018-01-271-2/+2
| | | | | | | | ... instead of creating our own special SQLiteMemoryDbPool, whose purpose was a bit of a mystery. For some reason this makes one of the tests run slightly slower, so bump the sleep(). Sorry.
* Optimise LoggingContext creation and copyingRichard van der Hoff2018-01-161-7/+7
| | | | | | | | It turns out that the only thing we use the __dict__ of LoggingContext for is `request`, and given we create lots of LoggingContexts and then copy them every time we do a db transaction or log line, using the __dict__ seems a bit redundant. Let's try to optimise things by making the request attribute explicit.
* Add some more tests for KeyringRichard van der Hoff2017-09-201-37/+140
|
* Fix concurrent server_key requests (#2458)Richard van der Hoff2017-09-191-3/+55
| | | | Fix a bug where we could end up firing off multiple requests for server_keys for the same server at the same time.
* Clean up and document handling of logcontexts in Keyring (#2452)Richard van der Hoff2017-09-181-0/+74
| | | | | | I'm still unclear on what the intended behaviour for `verify_json_objects_for_server` is, but at least I now understand the behaviour of most of the things it calls...
* Fix flake8 warnings for testsMark Haines2016-02-191-1/+0
|
* copyrightsMatthew Hodgson2016-01-072-2/+2
|
* Invoke EventBuilder directly instead of going via the EventBuilderFactoryPaul "LeoNerd" Evans2015-10-191-35/+3
|
* Capture __init__.pyPaul "LeoNerd" Evans2015-10-191-0/+15
|
* Use assertIn() instead of assertTrue on the 'in' operatorPaul "LeoNerd" Evans2015-10-191-6/+6
|
* Another signing test vector using an 'm.room.message' with content, so that ↵Paul "LeoNerd" Evans2015-10-191-1/+49
| | | | the implementation will have to redact it
* Initial minimial hack at a test of event hashing and signingPaul "LeoNerd" Evans2015-10-191-0/+98