summary refs log tree commit diff
path: root/tests/utils.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Improve lock performance when a lot of locks are waiting (#16840)Mathieu Velten2024-03-141-1/+41
| | | | | | | | | | | | When a lot of locks are waiting for a single lock, notifying all locks independently with `call_later` on each release is really costly and incurs some kind of async contention, where the CPU is spinning a lot for not much. The included test is taking around 30s before the change, and 0.5s after. It was found following failing tests with https://github.com/element-hq/synapse/pull/16827.
* Bump black from 23.10.1 to 24.2.0 (#16936)dependabot[bot]2024-03-131-4/+2
|
* Correctly mention previous copyright (#16820)Erik Johnston2024-01-231-0/+1
| | | | | During the migration the automated script to update the copyright headers accidentally got rid of some of the existing copyright lines. Reinstate them.
* Merge remote-tracking branch 'gitlab/clokep/license-license' into new_developErik Johnston2023-12-131-11/+16
|\
| * Update license headersPatrick Cloke2023-11-211-11/+16
| |
* | Keep track of `user_ips` and `monthly_active_users` when delegating auth ↵David Robertson2023-11-231-0/+7
|/ | | | | | | | | | | | | (#16672) * Describe `insert_client_ip` * Pull out client_ips and MAU tracking to BaseAuth * Define HAS_AUTHLIB once in tests sick of copypasting * Track ips and token usage when delegating auth * Test that we track MAU and user_ips * Don't track `__oidc_admin`
* Use dbname instead of database for Postgres config. (#16618)Patrick Cloke2023-11-091-1/+1
|
* Modify StoreKeyFetcher to read from server_keys_json. (#15417)Patrick Cloke2023-04-201-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Before this change: * `PerspectivesKeyFetcher` and `ServerKeyFetcher` write to `server_keys_json`. * `PerspectivesKeyFetcher` also writes to `server_signature_keys`. * `StoreKeyFetcher` reads from `server_signature_keys`. After this change: * `PerspectivesKeyFetcher` and `ServerKeyFetcher` write to `server_keys_json`. * `PerspectivesKeyFetcher` also writes to `server_signature_keys`. * `StoreKeyFetcher` reads from `server_keys_json`. This results in `StoreKeyFetcher` now using the results from `ServerKeyFetcher` in addition to those from `PerspectivesKeyFetcher`, i.e. keys which are directly fetched from a server will now be pulled from the database instead of refetched. An additional minor change is included to avoid creating a `PerspectivesKeyFetcher` (and checking it) if no `trusted_key_servers` are configured. The overall impact of this should be better usage of cached results: * If a server has no trusted key servers configured then it should reduce how often keys are fetched. * if a server's trusted key server does not have a requested server's keys cached then it should reduce how often keys are directly fetched.
* Use mypy 1.0 (#15052)David Robertson2023-02-161-1/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Update mypy and mypy-zope * Remove unused ignores These used to suppress ``` synapse/storage/engines/__init__.py:28: error: "__new__" must return a class instance (got "NoReturn") [misc] ``` and ``` synapse/http/matrixfederationclient.py:1270: error: "BaseException" has no attribute "reasons" [attr-defined] ``` (note that we check `hasattr(e, "reasons")` above) * Avoid empty body warnings, sometimes by marking methods as abstract E.g. ``` tests/handlers/test_register.py:58: error: Missing return statement [empty-body] tests/handlers/test_register.py:108: error: Missing return statement [empty-body] ``` * Suppress false positive about `JaegerConfig` Complaint was ``` synapse/logging/opentracing.py:450: error: Function "Type[Config]" could always be true in boolean context [truthy-function] ``` * Fix not calling `is_state()` Oops! ``` tests/rest/client/test_third_party_rules.py:428: error: Function "Callable[[], bool]" could always be true in boolean context [truthy-function] ``` * Suppress false positives from ParamSpecs ```` synapse/logging/opentracing.py:971: error: Argument 2 to "_custom_sync_async_decorator" has incompatible type "Callable[[Arg(Callable[P, R], 'func'), **P], _GeneratorContextManager[None]]"; expected "Callable[[Callable[P, R], **P], _GeneratorContextManager[None]]" [arg-type] synapse/logging/opentracing.py:1017: error: Argument 2 to "_custom_sync_async_decorator" has incompatible type "Callable[[Arg(Callable[P, R], 'func'), **P], _GeneratorContextManager[None]]"; expected "Callable[[Callable[P, R], **P], _GeneratorContextManager[None]]" [arg-type] ```` * Drive-by improvement to `wrapping_logic` annotation * Workaround false "unreachable" positives See https://github.com/Shoobx/mypy-zope/issues/91 ``` tests/http/test_proxyagent.py:626: error: Statement is unreachable [unreachable] tests/http/test_proxyagent.py:762: error: Statement is unreachable [unreachable] tests/http/test_proxyagent.py:826: error: Statement is unreachable [unreachable] tests/http/test_proxyagent.py:838: error: Statement is unreachable [unreachable] tests/http/test_proxyagent.py:845: error: Statement is unreachable [unreachable] tests/http/federation/test_matrix_federation_agent.py:151: error: Statement is unreachable [unreachable] tests/http/federation/test_matrix_federation_agent.py:452: error: Statement is unreachable [unreachable] tests/logging/test_remote_handler.py:60: error: Statement is unreachable [unreachable] tests/logging/test_remote_handler.py:93: error: Statement is unreachable [unreachable] tests/logging/test_remote_handler.py:127: error: Statement is unreachable [unreachable] tests/logging/test_remote_handler.py:152: error: Statement is unreachable [unreachable] ``` * Changelog * Tweak DBAPI2 Protocol to be accepted by mypy 1.0 Some extra context in: - https://github.com/matrix-org/python-canonicaljson/pull/57 - https://github.com/python/mypy/issues/6002 - https://mypy.readthedocs.io/en/latest/common_issues.html#covariant-subtyping-of-mutable-protocol-members-is-rejected * Pull in updated canonicaljson lib so the protocol check just works * Improve comments in opentracing I tried to workaround the ignores but found it too much trouble. I think the corresponding issue is https://github.com/python/mypy/issues/12909. The mypy repo has a PR claiming to fix this (https://github.com/python/mypy/pull/14677) which might mean this gets resolved soon? * Better annotation for INTERACTIVE_AUTH_CHECKERS * Drive-by AUTH_TYPE annotation, to remove an ignore
* Add a class UnpersistedEventContext to allow for the batching up of storing ↵Shay2023-02-091-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | state groups (#14675) * add class UnpersistedEventContext * modify create new client event to create unpersistedeventcontexts * persist event contexts after creation * fix tests to persist unpersisted event contexts * cleanup * misc lints + cleanup * changelog + fix comments * lints * fix batch insertion? * reduce redundant calculation * add unpersisted event classes * rework compute_event_context, split into function that returns unpersisted event context and then persists it * use calculate_context_info to create unpersisted event contexts * update typing * $%#^&* * black * fix comments and consolidate classes, use attr.s for class * requested changes * lint * requested changes * requested changes * refactor to be stupidly explicit * clearer renaming and flow * make partial state non-optional * update docstrings --------- Co-authored-by: Erik Johnston <erik@matrix.org>
* Modernize unit tests configuration settings for workers. (#14568)realtyem2022-12-011-3/+5
| | | | Use the newer foo_instances configuration instead of the deprecated flags to enable specific features (e.g. start_pushers).
* Update mypy and mypy-zope, attempt 3 (#13993)David Robertson2022-09-301-3/+1
| | | Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Revert "Update mypy and mypy-zope (#13925)"David Robertson2022-09-301-1/+3
| | | | This reverts commit 6d543d6d9f56e39199b7e460d0081b02d61f12be.
* Update mypy and mypy-zope (#13925)David Robertson2022-09-301-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Update mypy and mypy-zope * Unignore assigning to LogRecord attributes Presumably https://github.com/python/typeshed/pull/8064 makes this ok Cherry-picked from #13521 * Remove unused ignores due to mypy ParamSpec fixes https://github.com/python/mypy/pull/12668 Cherry-picked from #13521 * Remove additional unused ignores * Fix new mypy complaints related to `assertGreater` Presumably due to https://github.com/python/typeshed/pull/8077 * Changelog * Reword changelog Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com> Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Remove configuration options for direct TCP replication. (#13647)Patrick Cloke2022-09-061-1/+0
| | | Removes the ability to configure legacy direct TCP replication. Workers now require Redis to run.
* Revert "Update locked versions of mypy and mypy-zope (#13521)"David Robertson2022-08-151-1/+3
| | | | | | | | This reverts commit f383b9b3eceaa082d5ae690550fe41460b711779. Other PRs were seeing mypy failures that looked to be related to mypy-zope. Confusingly, we didn't see this on #13521. Revert this for now and investigate later.
* Update locked versions of mypy and mypy-zope (#13521)David Robertson2022-08-151-3/+1
|
* Rate limit joins per-room (#13276)David Robertson2022-07-191-0/+1
|
* Type `tests.utils` (#13028)David Robertson2022-07-051-44/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Cast to postgres types when handling postgres db * Remove unused method * Easy annotations * Annotate create_room * Use `ParamSpec` to annotate looping_call * Annotate `default_config` * Track `now` as a float `time_ms` returns an int like the proper Synapse `Clock` * Introduce a `Timer` dataclass * Introduce a Looper type * Suppress checking of a mock * tests.utils is typed * Changelog * Whoops, import ParamSpec from typing_extensions * ditch the psycopg2 casts
* Remove tests/utils.py from mypy's exclude list (#13159)Andrew Morgan2022-07-041-2/+2
|
* Change default `sync_response_cache_duration` (#13042)Erik Johnston2022-06-151-1/+1
|
* Rename storage classes (#12913)Erik Johnston2022-05-311-1/+1
|
* Allow specifying the Postgres database's port when running unit tests with ↵reivilibre2022-04-051-0/+8
| | | | Postgres. (#12376)
* Remove unused test code. (#12291)Patrick Cloke2022-03-241-110/+0
| | | | The `MockHttpResource` and `MockKey` objects were unused since #9396 (74af356baf79de5d719fad6c32b981eedbdd950d).
* Remove `HomeServer.get_datastore()` (#12031)Richard van der Hoff2022-02-231-1/+1
| | | | | | | The presence of this method was confusing, and mostly present for backwards compatibility. Let's get rid of it. Part of #11733
* Optionally use an on-disk sqlite db in tests (#11702)David Robertson2022-01-071-0/+4
| | | | | | | | | | | | | | | * Optionally use an on-disk sqlite db in tests When debugging a test it is sometimes useful to inspect the state of the DB. This is not easy when the db is in-memory: one cannot attach the sqlite CLI to another process's DB. With this change, if SYNAPSE_TEST_PERSIST_SQLITE_DB is set, we use `_trial_temp/test.db` as our sqlite database. One can then use `sqlite3 _trial_temp/test.db` and query to your heart's content. The DB is destroyed and recreated between different test cases. Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Refactor `tests.util.setup_test_homeserver` and ↵reivilibre2021-12-211-174/+1
| | | | `tests.server.setup_test_homeserver`. (#11503)
* Revert accidental commits to develop.Olivier Wilkinson (reivilibre)2021-12-031-1/+174
|
* Move `tests.utils.setup_test_homeserver` to `tests.server`Olivier Wilkinson (reivilibre)2021-12-031-174/+1
| | | | | | | It had no users. We have just taken the identity of a previous function but don't provide the same behaviour, so we need to fix this in the next commit...
* Remove code invalidated by deprecated config flag ↵Shay2021-11-231-1/+0
| | | | | | | | | | | | | | | | | | | | | 'trust_identity_servers_for_password_resets' (#11395) * remove background update code related to deprecated config flag * changelog entry * update changelog * Delete 11394.removal Duplicate, wrong number * add no-op background update and change newfragment so it will be consolidated with associated work * remove unused code * Remove code associated with deprecated flag from legacy docker dynamic config file Co-authored-by: reivilibre <oliverw@matrix.org>
* Remove unnecessary parentheses around tuples returned from methods (#10889)Andrew Morgan2021-09-231-1/+1
|
* Allow setting transaction limit for db connections (#10440)Toni Spets2021-08-021-0/+3
| | | | | | | Setting the value will help PostgreSQL free up memory by recycling the connections in the connection pool. Signed-off-by: Toni Spets <toni.spets@iki.fi>
* Remove room and user invite ratelimits in default unit test config (#9871)Andrew Morgan2021-04-231-0/+4
|
* Fix (final) Bugbear violations (#9838)Jonathan de Jong2021-04-201-1/+1
|
* Remove redundant "coding: utf-8" lines (#9786)Jonathan de Jong2021-04-141-1/+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>`
* Bump black configuration to target py36 (#9781)Dan Callahan2021-04-131-1/+1
| | | Signed-off-by: Dan Callahan <danc@element.io>
* Use mock from the stdlib. (#9772)Patrick Cloke2021-04-091-2/+1
|
* Replace `room_invite_state_types` with `room_prejoin_state` (#9700)Richard van der Hoff2021-03-301-1/+0
| | | | | | | `room_invite_state_types` was inconvenient as a configuration setting, because anyone that ever set it would not receive any new types that were added to the defaults. Here, we deprecate the old setting, and replace it with a couple of new settings under `room_prejoin_state`.
* Remove vestiges of uploads_path config (#9462)Richard van der Hoff2021-02-221-1/+0
| | | | `uploads_path` was a thing that was never used; most of it was removed in #6628 but a few vestiges remained.
* Update black, and run auto formatting over the codebase (#9381)Eric Eastwood2021-02-161-4/+6
| | | | | | | - 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
* Backout changes for automatically calculating the public baseurl. (#9313)Patrick Cloke2021-02-111-0/+1
| | | | This breaks some people's configurations (if their Client-Server API is not accessed via port 443).
* Ratelimit 3PID /requestToken API (#9238)Erik Johnston2021-01-281-0/+1
|
* Implement MSC2858 support (#9183)Richard van der Hoff2021-01-271-2/+1
| | | Fixes #8928.
* Give `public_baseurl` a default value (#9159)Richard van der Hoff2021-01-201-1/+0
|
* remove unused DeferredMockCallableRichard van der Hoff2020-12-021-90/+1
|
* remove unused `resource_for_federation`Richard van der Hoff2020-12-021-17/+0
| | | | This is now only used in `test_typing`, so move it there.
* Simplify the way the `HomeServer` object caches its internal attributes. ↵Jonathan de Jong2020-11-301-1/+1
| | | | | (#8565) Changes `@cache_in_self` to use underscore-prefixed attributes.
* Solidify the HomeServer constructor. (#8515)Jonathan de Jong2020-10-151-14/+17
| | | | | | This implements a more standard API for instantiating a homeserver and moves some of the dependency injection into the test suite. More concretely this stops using `setattr` on all `kwargs` passed to `HomeServer`.
* Clean-up some broken/unused code in the test framework (#8514)Patrick Cloke2020-10-091-68/+54
|
* Add logging on startup/shutdown (#8448)Erik Johnston2020-10-021-0/+2
| | | | | This is so we can tell what is going on when things are taking a while to start up. The main change here is to ensure that transactions that are created during startup get correctly logged like normal transactions.
* Allow background tasks to be run on a separate worker. (#8369)Patrick Cloke2020-10-021-1/+1
|
* Stop sub-classing object (#8249)Patrick Cloke2020-09-041-3/+3
|
* Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2020-07-311-12/+4
|\ | | | | | | erikj/add_rate_limiting_to_joins
| * Convert storage layer to async/await. (#7963)Patrick Cloke2020-07-281-12/+4
| |
* | Add ratelimiting on joinsErik Johnston2020-07-311-0/+4
|/
* Convert the message handler to async/await. (#7884)Patrick Cloke2020-07-221-1/+3
|
* Replace all remaining six usage with native Python 3 equivalents (#7704)Dagfinn Ilmari Mannsåker2020-06-161-1/+1
|
* Create a ListenerConfig object (#7681)Richard van der Hoff2020-06-161-0/+1
| | | | | | | | | | This ended up being a bit more invasive than I'd hoped for (not helped by generic_worker duplicating some of the code from homeserver), but hopefully it's an improvement. The idea is that, rather than storing unstructured `dict`s in the config for the listener configurations, we instead parse it into a structured `ListenerConfig` object.
* Allow configuration of Synapse's cache without using synctl or environment ↵Amber Brown2020-05-111-0/+1
| | | | variables (#6391)
* Persist user interactive authentication sessions (#7302)Patrick Cloke2020-04-301-4/+4
| | | | | By persisting the user interactive authentication sessions to the database, this fixes situations where a user hits different works throughout their auth session and also allows sessions to persist through restarts of Synapse.
* Fix collation for postgres for unit tests (#7359)Richard van der Hoff2020-04-281-1/+4
| | | | When running the UTs against a postgres deatbase, we need to set the collation correctly.
* Convert auth handler to async/await (#7261)Patrick Cloke2020-04-151-4/+9
|
* Clean up some LoggingContext stuff (#7120)Richard van der Hoff2020-03-241-3/+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 `rooms.room_version` column (#6729)Erik Johnston2020-01-271-0/+8
| | | This is so that we don't have to rely on pulling it out from `current_state_events` table.
* Split state groups into a separate data store (#6296)Erik Johnston2019-12-201-1/+1
|
* Add database config class (#6513)Erik Johnston2019-12-181-29/+14
| | | | | This encapsulates config for a given database and is the way to get new connections.
* Remove database config parsing from apps.Erik Johnston2019-12-101-2/+0
|
* Fixup testsErik Johnston2019-12-051-1/+3
|
* Implementation of MSC2314 (#6176)Amber Brown2019-11-281-0/+1
|
* Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2019-10-301-1/+0
|\ | | | | | | erikj/split_out_persistence_store
| * Option to suppress resource exceeded alerting (#6173)Neil Johnson2019-10-241-1/+0
| | | | | | | | The expected use case is to suppress MAU limiting on small instances
* | Use new EventPersistenceStoreErik Johnston2019-10-231-2/+8
|/
* Fix postgres unit tests to use prepare_databaseErik Johnston2019-10-221-10/+2
|
* Remove unnecessary parentheses around return statements (#5931)Andrew Morgan2019-08-301-1/+1
| | | | | Python will return a tuple whether there are parentheses around the returned values or not. I'm just sick of my editor complaining about this all over the place :)
* Remove non-functional 'expire_access_token' setting (#5782)Richard van der Hoff2019-07-301-1/+0
| | | | | | | | The `expire_access_token` didn't do what it sounded like it should do. What it actually did was make Synapse enforce the 'time' caveat on macaroons used as access tokens, but since our access token macaroons never contained such a caveat, it was always a no-op. (The code to add 'time' caveats was removed back in v0.18.5, in #1656)
* Merge tag 'v1.2.0rc2' into developAndrew Morgan2019-07-241-1/+1
|\ | | | | | | | | | | | | Bugfixes -------- - Fix a regression introduced in v1.2.0rc1 which led to incorrect labels on some prometheus metrics. ([\#5734](https://github.com/matrix-org/synapse/issues/5734))
| * Fix servlet metric names (#5734)Jorik Schellekens2019-07-241-1/+1
| | | | | | | | | | | | | | | | | | | | * Fix servlet metric names Co-Authored-By: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> * Remove redundant check * Cover all return paths
* | Replace returnValue with return (#5736)Amber Brown2019-07-231-3/+3
|/
* Fixes to the federation rate limiter (#5621)Richard van der Hoff2019-07-051-6/+0
| | | | | | | - Put the default window_size back to 1000ms (broken by #5181) - Make the `rc_federation` config actually do something - fix an off-by-one error in the 'concurrent' limit - Avoid creating an unused `_PerHostRatelimiter` object for every single incoming request
* Move logging utilities out of the side drawer of util/ and into logging/ (#5606)Amber Brown2019-07-041-1/+1
|
* Pass config_dir_path and data_dir_path into Config.read_config. (#5522)Richard van der Hoff2019-06-241-1/+1
| | | | | | * Pull config_dir_path and data_dir_path calculation out of read_config_files * Pass config_dir_path and data_dir_path into read_config
* Run Black. (#5482)Amber Brown2019-06-201-9/+9
|
* Set default room version to v4. (#5379)Neil Johnson2019-06-061-1/+2
| | | | Set default room version to v4.
* Add ability to perform password reset via email without trusting the ↵Andrew Morgan2019-06-061-1/+0
| | | | | | | | | | | | identity server (#5377) Sends password reset emails from the homeserver instead of proxying to the identity server. This is now the default behaviour for security reasons. If you wish to continue proxying password reset requests to the identity server you must now enable the email.trust_identity_server_for_password_resets option. This PR is a culmination of 3 smaller PRs which have each been separately reviewed: * #5308 * #5345 * #5368
* Make all the rate limiting options more consistent (#5181)Amber Brown2019-05-151-12/+8
|
* Use correct config option for ratelimiting in testsErik Johnston2019-05-141-1/+2
|
* Migrate all tests to use the dict-based config format instead of hanging ↵Amber Brown2019-05-131-69/+63
| | | | items off HomeserverConfig (#5171)
* Run Black on the tests again (#5170)Amber Brown2019-05-101-3/+6
|
* Collect room-version variations into one place (#4969)Richard van der Hoff2019-04-011-2/+3
| | | | Collect all the things that make room-versions different to one another into one place, so that it's easier to define new room versions.
* Use an explicit dbname for postgres connections in the tests. (#4928)Richard van der Hoff2019-03-251-18/+16
| | | | | | I don't have a database with the same name as my user, so leaving the database name unset fails. While we're at it, clear out some unused stuff in the test setup.
* Add testErik Johnston2019-03-201-2/+0
|
* Use a regular HomeServerConfig object for unit testsRichard van der Hoff2019-03-191-11/+15
| | | | | | | Rather than using a Mock for the homeserver config, use a genuine HomeServerConfig object. This makes for a more realistic test, and means that we don't have to keep remembering to add things to the mock config every time we add a new config setting.
* Add ratelimiting on failed login attempts (#4865)Brendan Abolivier2019-03-181-0/+2
|
* Add ratelimiting on login (#4821)Brendan Abolivier2019-03-151-2/+6
| | | Add two ratelimiters on login (per-IP address and per-userID).
* setup masterAmber Brown2019-03-111-0/+2
|
* Disable captcha registration by default in testsAndrew Morgan2019-03-081-0/+1
|
* Add rate-limiting on registration (#4735)Brendan Abolivier2019-03-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Rate-limiting for registration * Add unit test for registration rate limiting * Add config parameters for rate limiting on auth endpoints * Doc * Fix doc of rate limiting function Co-Authored-By: babolivier <contact@brendanabolivier.com> * Incorporate review * Fix config parsing * Fix linting errors * Set default config for auth rate limiting * Fix tests * Add changelog * Advance reactor instead of mocked clock * Move parameters to registration specific config and give them more sensible default values * Remove unused config options * Don't mock the rate limiter un MAU tests * Rename _register_with_store into register_with_store * Make CI happy * Remove unused import * Update sample config * Fix ratelimiting test for py2 * Add non-guest test
* Update test_typing to use HomeserverTestCase. (#4771)Richard van der Hoff2019-03-041-14/+21
|
* Move from TravisCI to BuildKite (#4752)Amber Brown2019-02-271-10/+34
|
* Fix unit testsErik Johnston2019-02-271-0/+6
|
* Fix testsErik Johnston2019-01-251-1/+2
|
* Revert "Require event format version to parse or create events"Erik Johnston2019-01-251-2/+1
|
* Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2019-01-241-1/+3
|\ | | | | | | erikj/require_format_version
| * Fix None guard in config.server.is_threepid_reservedNeil Johnson2019-01-221-1/+3
| |
* | Fix testsErik Johnston2019-01-241-1/+2
|/
* Return well_known in /login response (#4319)Richard van der Hoff2018-12-241-0/+3
| | | | ... as per MSC1730.
* create support user (#4141)Neil Johnson2018-12-141-1/+0
| | | | | | Allow for the creation of a support user. A support user can access the server, join rooms, interact with other users, but does not appear in the user directory nor does it contribute to monthly active user limits.
* Implement SAML2 authentication (#4267)Richard van der Hoff2018-12-071-0/+1
| | | | | | | | | | | This implements both a SAML2 metadata endpoint (at `/_matrix/saml2/metadata.xml`), and a SAML2 response receiver (at `/_matrix/saml2/authn_response`). If the SAML2 response matches what's been configured, we complete the SSO login flow by redirecting to the client url (aka `RelayState` in SAML2 jargon) with a login token. What we don't yet have is anything to build a SAML2 request and redirect the user to the identity provider. That is left as an exercise for the reader.
* Add option to track MAU stats (but not limit people) (#3830)Travis Ralston2018-11-151-0/+1
|
* Add config variables for enabling terms auth and the policy name (#4142)Travis Ralston2018-11-061-0/+2
| | | | So people can still collect consent the old way if they want to.
* Merge branch 'develop' into matthew/autocreate_autojoinNeil Johnson2018-10-041-51/+61
|\
| * Disable frozen dicts by default (#3987)Amber Brown2018-10-021-1/+2
| |
| * Fix userconsent on Python 3 (#3938)Amber Brown2018-10-021-48/+57
| |
* | move logic into register, fix room alias localpart bug, testsNeil Johnson2018-10-041-0/+1
|/
* Fix client IPs being broken on Python 3 (#3908)Amber Brown2018-09-201-2/+25
|
* Port tests/ to Python 3 (#3808)Amber Brown2018-09-071-15/+19
|
* Merge pull request #3800 from matrix-org/neilj/remove-guests-from-mau-count hhs-6Neil Johnson2018-09-061-0/+1
|\ | | | | guest users should not be part of mau total
| * ensure guests never enter mau listNeil Johnson2018-09-061-0/+1
| |
* | Merge branch 'master' into developRichard van der Hoff2018-09-061-3/+9
|\ \ | |/ |/|
| * Fix origin handling for pushed transactionsRichard van der Hoff2018-09-051-3/+9
| | | | | | | | | | Use the actual origin for push transactions, rather than whatever the remote server claimed.
* | Fix tests on postgresql (#3740)Amber Brown2018-09-041-4/+6
| |
* | move threepid checker to config, add missing yieldsNeil Johnson2018-08-311-0/+6
| |
* | Port storage/ to Python 3 (#3725)Amber Brown2018-08-311-0/+2
| |
* | Fix up testsRichard van der Hoff2018-08-281-2/+6
| |
* | Change admin_uri to admin_contact in config and errorsErik Johnston2018-08-241-1/+1
| |
* | Merge branch 'develop' of github.com:matrix-org/synapse into ↵Erik Johnston2018-08-201-61/+155
|\| | | | | | | erikj/refactor_state_handler
| * Integrate presence from hotfixes (#3694)Amber Brown2018-08-181-3/+4
| |
| * add new error type ResourceLimitNeil Johnson2018-08-161-0/+1
| |
| * replace admin_email with admin_uri for greater flexibilityNeil Johnson2018-08-151-1/+1
| |
| * support admin_email config and pass through into blocking errors, return ↵Neil Johnson2018-08-131-0/+1
| | | | | | | | AuthError in all cases
| * Revert "support admin_email config and pass through into blocking errors, ↵Neil Johnson2018-08-131-1/+0
| | | | | | | | | | | | return AuthError in all cases" This reverts commit 0d43f991a19840a224d3dac78d79f13d78212ee6.
| * support admin_email config and pass through into blocking errors, return ↵Neil Johnson2018-08-131-0/+1
| | | | | | | | AuthError in all cases
| * Run tests under PostgreSQL (#3423)Amber Brown2018-08-131-18/+115
| |
| * Run black.black2018-08-101-43/+35
| |
| * Merge pull request #3439 from vojeroen/send_sni_for_federation_requestsRichard van der Hoff2018-08-101-0/+2
| |\ | | | | | | send SNI for federation requests
| | * Merge branch 'develop' into send_sni_for_federation_requestsRichard van der Hoff2018-07-271-0/+3
| | |\
| | * \ Merge remote-tracking branch 'upstream/develop' into ↵Jeroen2018-07-141-1/+3
| | |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | send_sni_for_federation_requests # Conflicts: # synapse/crypto/context_factory.py
| | * | | send SNI for federation requestsJeroen2018-06-241-0/+2
| | | | |
* | | | | Fix testsErik Johnston2018-08-091-0/+30
|/ / / /
* | | | Merge pull request #3655 from matrix-org/neilj/disable_hsNeil Johnson2018-08-091-0/+2
|\ \ \ \ | | | | | | | | | | Flag to disable HS without disabling federation
| * \ \ \ Merge branch 'develop' into neilj/disable_hsNeil Johnson2018-08-081-0/+4
| |\ \ \ \
| * \ \ \ \ Merge branch 'develop' into neilj/disable_hsNeil Johnson2018-08-081-0/+2
| |\ \ \ \ \
| * | | | | | disable HS from configNeil Johnson2018-08-041-0/+2
| | | | | | |
* | | | | | | Test fixes for Python 3 (#3647)Amber Brown2018-08-091-4/+5
| |_|/ / / / |/| | | | |
* | | | | | Merge pull request #3654 from matrix-org/rav/room_versionsRichard van der Hoff2018-08-081-0/+4
|\ \ \ \ \ \ | |_|/ / / / |/| | | | | Support for room versioning
| * | | | | Basic support for room versioningRichard van der Hoff2018-08-031-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the first tranche of support for room versioning. It includes: * setting the default room version in the config file * new room_version param on the createRoom API * storing the version of newly-created rooms in the m.room.create event * fishing the version of existing rooms out of the m.room.create event
* | | | | | mock config.max_mau_valueNeil Johnson2018-08-081-0/+1
| | | | | |
* | | | | | add default mau_limits_reserved_threepidsNeil Johnson2018-08-061-0/+1
| |/ / / / |/| | | |
* | | | | fix (lots of) py3 test failuresNeil Johnson2018-08-031-0/+1
|/ / / /
* | | / Python 3: Convert some unicode/bytes uses (#3569)Amber Brown2018-08-021-3/+6
| |_|/ |/| |
* | | Admin API for creating new users (#3415)Amber Brown2018-07-201-0/+3
| |/ |/|
* | Fix unit testsRichard van der Hoff2018-07-131-0/+1
| |
* | run isortAmber Brown2018-07-091-1/+2
|/
* Pass around the reactor explicitly (#3385)Amber Brown2018-06-221-1/+6
|
* Reject attempts to send event before privacy consent is givenRichard van der Hoff2018-05-221-0/+1
| | | | | | Returns an M_CONSENT_NOT_GIVEN error (cf https://github.com/matrix-org/matrix-doc/issues/1252) if consent is not yet given.
* Move consent config parsing into ConsentConfigRichard van der Hoff2018-05-221-1/+1
| | | | turns out we need to reuse this, so it's better in the config class.
* Send users a server notice about consentRichard van der Hoff2018-05-221-0/+1
| | | | | When a user first syncs, we will send them a server notice asking them to consent to the privacy policy if they have not already done so.
* Merge pull request #3108 from NotAFile/py3-six-urlparseRichard van der Hoff2018-04-301-3/+2
|\ | | | | Use six.moves.urlparse
| * Use six.moves.urlparseAdrian Tschira2018-04-151-3/+2
| | | | | | | | | | | | The imports were shuffled around a bunch in py3 Signed-off-by: Adrian Tschira <nota@notafile.com>
* | Add some more variables to the unittest configAdrian Tschira2018-04-151-0/+4
|/ | | | | | | These worked accidentally before (python2 doesn't complain if you compare incompatible types) but under py3 this blows up spectacularly Signed-off-by: Adrian Tschira <nota@notafile.com>
* Add b prefixes to some strings that are bytes in py3Adrian Tschira2018-04-041-1/+1
| | | | | | This has no effect on python2 Signed-off-by: Adrian Tschira <nota@notafile.com>
* Add tests for user directory searchRichard van der Hoff2018-01-271-0/+1
|
* Make it possible to run tests against postgresRichard van der Hoff2018-01-271-9/+34
|
* Create dbpool as normal in testsRichard van der Hoff2018-01-271-43/+17
| | | | | | | | ... 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.
* Run on_new_connection for unit testsRichard van der Hoff2018-01-271-7/+17
| | | | | Configure the connectionpool used for unit tests to run the `on_new_connection` function.
* Remove unused/bitrotted MemoryDataStoreRichard van der Hoff2018-01-261-151/+13
| | | | This isn't used, and looks thoroughly bitrotted.
* Add federation_domain_whitelist option (#2820)Matthew Hodgson2018-01-221-0/+1
| | | | | | Add federation_domain_whitelist gives a way to restrict which domains your HS is allowed to federate with. useful mainly for gracefully preventing a private but internet-connected HS from trying to federate to the wider public Matrix network
* Disable user_directory updates for UTsRichard van der Hoff2018-01-091-0/+4
| | | | | Fix flakiness in the UTs caused by the user_directory being updated in the background
* fix testsRichard van der Hoff2017-10-311-0/+1
|
* replace 'except:' with 'except Exception:'Richard van der Hoff2017-10-231-4/+4
| | | | what could possibly go wrong
* Add a config option to block all room invites (#2457)Richard van der Hoff2017-09-191-0/+1
| | | | | - allows sysadmins the ability to lock down their servers so that people can't send their users room invites.
* Only load jinja2 templates onceErik Johnston2017-05-221-0/+1
| | | | | Instead of every time a new email pusher is created, as loading jinja2 templates is slow.
* Fix unit testsErik Johnston2016-12-091-0/+4
|
* Fix testsErik Johnston2016-11-231-0/+1
|
* Fix tests and flake8Erik Johnston2016-11-221-0/+1
|
* Fix testsErik Johnston2016-11-211-0/+2
|
* Merge pull request #1098 from matrix-org/markjh/bearer_tokenMark Haines2016-10-251-4/+14
|\ | | | | Allow clients to supply access_tokens as headers
| * Fix unit testsMark Haines2016-09-121-4/+14
| |
* | Merge pull request #1164 from pik/error-codesErik Johnston2016-10-191-1/+1
|\ \ | | | | | | Clarify Error codes for GET /filter/
| * | Fix MockHttpRequest always returning M_UNKNOWN errcode in testingpik2016-10-141-1/+1
| | |
* | | Implement pluggable password authErik Johnston2016-10-031-0/+1
|/ / | | | | | | | | | | Allows delegating the password auth to an external module. This also moves the LDAP auth to using this system, allowing it to be removed from the synapse tree entirely in the future.
* / Time out typing over federationErik Johnston2016-09-231-1/+8
|/
* Add `create_requester` functionRichard van der Hoff2016-07-261-5/+0
| | | | | Wrap the `Requester` constructor with a function which provides sensible defaults, and use it throughout
* Rework ldap integration with ldap3Martin Weinelt2016-06-221-0/+1
| | | | | | | | | | | | | | | | | | | Use the pure-python ldap3 library, which eliminates the need for a system dependency. Offer both a `search` and `simple_bind` mode, for more sophisticated ldap scenarios. - `search` tries to find a matching DN within the `user_base` while employing the `user_filter`, then tries the bind when a single matching DN was found. - `simple_bind` tries the bind against a specific DN by combining the localpart and `user_base` Offer support for STARTTLS on a plain connection. The configuration was changed to reflect these new possibilities. Signed-off-by: Martin Weinelt <hexa@darmstadt.ccc.de>
* Enable use_frozen_events in testsErik Johnston2016-06-171-0/+1
|
* Split out the auth handlerDavid Baker2016-06-021-10/+5
|
* Inject fake room list handler in testsDavid Baker2016-06-011-0/+2
| | | | Otherwise it tries to start the remote public room list updating looping call which breaks.
* Replaces calls to fetch_room_distributions_into with get_joined_hosts_for_roomMark Haines2016-05-161-1/+1
|
* Create user with expiryNegi Fazeli2016-05-131-0/+1
| | | | | | - Add unittests for client, api and handler Signed-off-by: Negar Fazeli <negar.fazeli@ericsson.com>
* Don't require config to create databaseErik Johnston2016-04-061-3/+3
|
* tests/utils: added room_invite_state_types to test configPatrik Oldsberg2016-03-041-0/+1
| | | | Signed-off-by: Patrik Oldsberg <patrik.oldsberg@ericsson.com>
* Pass whole requester to ratelimitingDaniel Wagner-Hall2016-03-031-0/+5
| | | | This will enable more detailed decisions
* Merge pull request #571 from matrix-org/daniel/asidsDaniel Wagner-Hall2016-03-031-6/+14
|\ | | | | Mark AS users with their AS's ID
| * Mark AS users with their AS's IDDaniel Wagner-Hall2016-02-111-6/+14
| |
* | Add a /replication API for extracting the updates that happened onMark Haines2016-03-011-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | synapse This is necessary for replicating the data in synapse to be visible to a separate service because presence and typing notifications aren't stored in a database so won't be visible to another process. This API can be used to either get the raw data by requesting the tables themselves or to just receive notifications for updates by following the streams meta-stream. Returns updates for each table requested a JSON array of arrays with a row for each row in the table. Each table is prefixed by a header row with the: name of the table, current stream_id position for the table, number of rows, number of columns and the names of the columns. This is followed by the rows that have been added to the server since the requester last asked. The API has a timeout and is hooked up to the notifier so that a slave can long poll for updates.
* | Fix flake8 warnings for testsMark Haines2016-02-191-17/+13
| |
* | Initial cutErik Johnston2016-02-171-2/+2
|/
* Rename config field to reflect yaml nameDaniel Wagner-Hall2016-02-031-1/+1
|
* Fix the mock homserver used in the testsMark Haines2016-01-291-0/+1
|
* Fix testsErik Johnston2016-01-271-0/+8
|
* Remove redundated BaseHomeServerErik Johnston2016-01-261-0/+18
|
* copyrightsMatthew Hodgson2016-01-071-1/+1
|
* Host /unstable and /r0 versions of r0 APIsDaniel Wagner-Hall2015-12-011-2/+3
|
* Test for background updatesMark Haines2015-11-101-0/+3
|
* Remove more unused parametersDaniel Wagner-Hall2015-11-021-1/+1
|
* rename schema_prepare to prepare_databaseErik Johnston2015-10-131-1/+1
|
* Expose error more nicelyErik Johnston2015-10-131-1/+1
|
* Swap out bcrypt for md5 in testsDaniel Wagner-Hall2015-08-261-0/+13
| | | | This reduces our ~8 second sequential test time down to ~7 seconds
* Stop looking up "admin", which we never readDaniel Wagner-Hall2015-08-251-1/+0
|
* Remove completely unused concepts from codebaseDaniel Wagner-Hall2015-08-251-2/+1
| | | | | | | | | | Removes device_id and ClientInfo device_id is never actually written, and the matrix.org DB has no non-null entries for it. Right now, it's just cluttering up code. This doesn't remove the columns from the database, because that's fiddly.
* s/by_token/by_access_token/gDaniel Wagner-Hall2015-08-201-1/+1
| | | | We're about to have two kinds of token, access and refresh
* Issue macaroons as opaque auth tokensDaniel Wagner-Hall2015-08-181-0/+2
| | | | | | | | | | | | | This just replaces random bytes with macaroons. The macaroons are not inspected by the client or server. In particular, they claim to have an expiry time, but nothing verifies that they have not expired. Follow-up commits will actually enforce the expiration, and allow for token refresh. See https://bit.ly/matrix-auth for more information
* Fix testsErik Johnston2015-06-121-0/+2
|
* Discard unused NotifierUserStreamsMark Haines2015-05-131-0/+3
|
* Don't bother checking for updates if the stream token hasn't advanced for a userMark Haines2015-05-131-1/+1
|
* Make work in both Maria and SQLite. Fix testsErik Johnston2015-04-011-1/+10
|
* Update testsErik Johnston2015-02-191-0/+1
|
* Use git aware version string in User-Agent and Server headersErik Johnston2015-02-181-2/+8
|
* Add a cache for get_eventMark Haines2015-02-111-0/+1
|
* Factor out some of the common homeserver setup code into aMark Haines2015-02-111-0/+23
| | | | setup_test_homeserver function in utils.
* Have MockClock detect attempts to cancel expired timers, to prevent a repeat ↵Paul "LeoNerd" Evans2015-01-131-4/+16
| | | | of SYN-230
* Kill off synapse.api.events.*Erik Johnston2014-12-161-6/+2
|
* Fix tests and remove debug loggingErik Johnston2014-12-121-2/+7
|
* Implement .cancel_call_later() in MockClockPaul "LeoNerd" Evans2014-12-101-2/+5
|
* Implement .call_later() in MockClockPaul "LeoNerd" Evans2014-12-101-0/+26
|
* Sign outgoing PDUs.Mark Haines2014-10-161-1/+2
|
* Raise a SynapseError if the authorisation header is missing or malformedMark Haines2014-10-131-0/+4
|
* Verify signatures for server2server requestsMark Haines2014-10-131-0/+3
|
* Merge branch 'develop' into server2server_signingMark Haines2014-09-301-2/+9
|\ | | | | | | | | | | Conflicts: synapse/storage/__init__.py tests/rest/test_presence.py
| * Unbreak tests after changing storage APIErik Johnston2014-09-291-2/+6
| |
| * Track the IP users connect with. Add an admin column to users table.Erik Johnston2014-09-261-0/+3
| |
| * Fix test.Erik Johnston2014-09-241-1/+1
| |
* | Sign federation transactionsMark Haines2014-09-241-0/+15
|/
* Move SQLiteMemoryDbPool implementation into tests.utilsPaul "LeoNerd" Evans2014-09-101-0/+14
|
* fix the copyright holder from matrix.org to OpenMarket Ltd, as matrix.org ↵Matthew Hodgson2014-09-031-1/+1
| | | | hasn't been incorporated in time for launch.
* Fix room permissions testErik Johnston2014-09-021-0/+3
|
* Fix the tests to include new db callsErik Johnston2014-09-011-0/+14
|
* Have MemoryDataStore's get_rooms_for_user_where_membership_is() return room ↵Paul "LeoNerd" Evans2014-09-011-2/+3
| | | | membership event objects, as per interface contract
* Fix a couple of bugs in presence handler related to pushing updatesto the ↵Erik Johnston2014-08-291-6/+31
| | | | correct user. Fix presence tests.
* Ability to assert a DeferredMockCallable has received no callsPaul "LeoNerd" Evans2014-08-281-0/+15
|
* Remove get_state_for_room function from federation handlerMark Haines2014-08-281-0/+10
|
* Fill out prev_events before calling persist_eventMark Haines2014-08-271-1/+3
|
* Merge branch 'develop' into storage_transactionsMark Haines2014-08-261-3/+5
|\ | | | | | | | | | | | | Conflicts: synapse/api/auth.py synapse/handlers/room.py synapse/storage/__init__.py
| * Fix ALL THE UNIT TESTSKegan Dougal2014-08-261-3/+5
| |
* | Take a snapshot of the state of the room before performing updatesMark Haines2014-08-221-0/+7
|/
* Merge branch 'master' of github.com:matrix-org/synapse into sql_refactorErik Johnston2014-08-191-1/+42
|\ | | | | | | | | | | | | Conflicts: tests/rest/test_presence.py tests/rest/test_rooms.py tests/utils.py
| * Add a DeferredMockCallable; like mock's MockCallable but allows awaitingPaul "LeoNerd" Evans2014-08-191-0/+41
| | | | | | | | on method calls to be made later
| * Rename MockHttpServer to MockHttpResource as it stands for one server ↵Paul "LeoNerd" Evans2014-08-191-1/+2
| | | | | | | | resource rather than an entire server
* | Change the MemoryDataStore to implement new storage apiErik Johnston2014-08-181-99/+50
| |
* | Fix some of the tests to reflect changes in the storage layer.Erik Johnston2014-08-151-22/+2
|/