summary refs log tree commit diff
path: root/tests/crypto (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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