summary refs log tree commit diff
path: root/scripts-dev/check_auth.py (unfollow)
Commit message (Collapse)AuthorFilesLines
2019-07-18enable aggregations support by defaultNeil Johnson1-1/+1
2019-07-18Clean up opentracing configuration options (#5712)Richard van der Hoff7-63/+96
Clean up config settings and dead code. This is mostly about cleaning up the config format, to bring it into line with our conventions. In particular: * There should be a blank line after `## Section ##' headings * There should be a blank line between each config setting * There should be a `#`-only line between a comment and the setting it describes * We don't really do the `# #` style commenting-out of whole sections if we can help it * rename `tracer_enabled` to `enabled` While we're here, do more config parsing upfront, which makes it easier to use later on. Also removes redundant code from LogContextScopeManager. Also changes the changelog fragment to a `feature` - it's exciting!
2019-07-18Support Prometheus_client 0.4.0+ (#5636)Amber Brown20-50/+399
2019-07-18Remove the ability to query relations when the original event was redacted. ↵Andrew Morgan5-39/+180
(#5629) Fixes #5594 Forbid viewing relations on an event once it has been redacted.
2019-07-18Convert synapse.federation.transport.server to async (#5689)Richard van der Hoff2-242/+189
* Convert BaseFederationServlet._wrap to async Empirically, this fixes some lost stacktraces. It should be safe because the wrapped function is called from JsonResource._async_render, which is already async. * Convert the rest of synapse.federation.transport.server to async We may as well do the whole file while we're here. * changelog * flake8
2019-07-17Ignore redactions of m.room.create events (#5701)Richard van der Hoff5-24/+57
2019-07-17Improve `Depends` specs in debian package. (#5675)Richard van der Hoff6-3/+33
This is basically a contrived way of adding a `Recommends` on `libpq5`, to fix #5653. The way this is supposed to happen in debhelper is to run `dh_shlibdeps`, which in turn runs `dpkg-shlibdeps`, which spits things out into `debian/<package>.substvars` whence they can later be included by `control`. Previously, we had disabled `dh_shlibdeps`, mostly because `dpkg-shlibdeps` gets confused about PIL's interdependent objects, but that's not really the right thing to do and there is another way to work around that. Since we don't always use postgres, we don't necessarily want a hard Depends on libpq5, so I've actually ended up adding an explicit invocation of `dpkg-shlibdeps` for `psycopg2`. I've also updated the build-depends list for the package, which was missing a couple of entries.
2019-07-17More refactoring in `get_events_as_list` (#5707)Richard van der Hoff4-27/+198
We can now use `_get_events_from_cache_or_db` rather than going right back to the database, which means that (a) we can benefit from caching, and (b) it opens the way forward to more extensive checks on the original event. We now always require the original event to exist before we will serve up a redaction.
2019-07-17Fix redaction authentication (#5700)Richard van der Hoff2-85/+131
Ensures that redactions are correctly authenticated for recent room versions. There are a few things going on here: * `_fetch_event_rows` is updated to return a dict rather than a list of rows. * Rather than returning multiple copies of an event which was redacted multiple times, it returns the redactions as a list within the dict. * It also returns the actual rejection reason, rather than merely the fact that it was rejected, so that we don't have to query the table again in `_get_event_from_row`. * The redaction handling is factored out of `_get_event_from_row`, and now checks if any of the redactions are valid.
2019-07-17Refactor `get_events_as_list` (#5699)Richard van der Hoff2-48/+75
A couple of changes here: * get rid of a redundant `allow_rejected` condition - we should already have filtered out any rejected events before we get to that point in the code, and the redundancy is confusing. Instead, let's stick in an assertion just to make double-sure we aren't leaking rejected events by mistake. * factor out a `_get_events_from_cache_or_db` method, which is going to be important for a forthcoming fix to redactions.
2019-07-16Remove pointless descriptionErik Johnston1-1/+0
2019-07-16Clean up arg name and remove lying commentErik Johnston1-7/+5
2019-07-16Fix typo in synapse/app/admin_cmd.pyErik Johnston1-1/+1
Co-Authored-By: Aaron Raimist <aaron@raim.ist>
2019-07-15Fix invoking add_argument from homeserver.pyErik Johnston1-1/+1
2019-07-15s/exfiltrate_user_data/export_user_data/Erik Johnston1-1/+1
2019-07-15Add FileExfiltrationWriterErik Johnston1-1/+69
2019-07-15Use set_defaults(func=) styleErik Johnston1-11/+8
2019-07-15Move creation of ArgumentParser to callerErik Johnston2-11/+8
2019-07-15Fix up commentsErik Johnston2-3/+3
2019-07-15Change add_arguments to be a static methodErik Johnston5-5/+39
2019-07-15Return a different error from Invalid Password when a user is deactivated ↵Andrew Morgan3-0/+26
(#5674) Return `This account has been deactivated` instead of `Invalid password` when a user is deactivated.
2019-07-12Add a `docker` type to the towncrier configuration (#5673)Richard van der Hoff7-14/+27
... and certain other changelog-related fixes
2019-07-12Implement access token expiry (#5660)Richard van der Hoff14-31/+253
Record how long an access token is valid for, and raise a soft-logout once it expires.
2019-07-12Fixup docstringsErik Johnston1-7/+5
2019-07-12fix typo: backgroud -> backgroundAndrew Morgan2-5/+5
2019-07-12fix changelog nameRichard van der Hoff1-0/+0
2019-07-12Update reverse_proxy.rst (#5397)Ulrik Günther2-0/+3
Updates reverse_proxy.rst with information about nginx' URI normalisation.
2019-07-12Add missing space in default logging file format generated by the Docker ↵Slavi Pantaleev2-1/+2
image (#5620) This adds a missing space, without which log lines appear uglier. Signed-off-by: Slavi Pantaleev <slavi@devture.com>
2019-07-12Upgrade Alpine Linux used in the Docker image (3.8 -> 3.10) (#5619)Slavi Pantaleev2-2/+3
Alpine Linux 3.8 is still supported, but it seems like it's quite outdated now. While Python should be the same on both, all other libraries, etc., are much newer in Alpine 3.9 and 3.10. Signed-off-by: Slavi Pantaleev <slavi@devture.com>
2019-07-12Add a mechanism for per-test configs (#5657)Richard van der Hoff2-1/+55
It's useful to be able to tweak the homeserver config to be used for each test. This PR adds a mechanism to do so.
2019-07-11Use /src for checking out synapse during sytests (#5664)Amber Brown2-0/+4
2019-07-11 Improved docs on setting up Postgresql (#5661)Lrizika2-4/+16
Added that synapse_user needs a database to access before it can auth Noted you'll need to enable password auth, linked to pg_hba.conf docs
2019-07-11small typo fix (#5655)Andrew Morgan2-1/+2
2019-07-11Clean up exception handling for access_tokens (#5656)Richard van der Hoff6-100/+111
First of all, let's get rid of `TOKEN_NOT_FOUND_HTTP_STATUS`. It was a hack we did at one point when it was possible to return either a 403 or a 401 if the creds were missing. We always return a 401 in these cases now (thankfully), so it's not needed. Let's also stop abusing `AuthError` for these cases. Honestly they have nothing that relates them to the other places that `AuthError` is used, other than the fact that they are loosely under the 'Auth' banner. It makes no sense for them to share exception classes. Instead, let's add a couple of new exception classes: `InvalidClientTokenError` and `MissingClientTokenError`, for the `M_UNKNOWN_TOKEN` and `M_MISSING_TOKEN` cases respectively - and an `InvalidClientCredentialsError` base class for the two of them.
2019-07-11Add basic opentracing support (#5544)Jorik Schellekens12-12/+633
* Configure and initialise tracer Includes config options for the tracer and sets up JaegerClient. * Scope manager using LogContexts We piggy-back our tracer scopes by using log context. The current log context gives us the current scope. If new scope is created we create a stack of scopes in the context. * jaeger is a dependency now * Carrier inject and extraction for Twisted Headers * Trace federation requests on the way in and out. The span is created in _started_processing and closed in _finished_processing because we need a meaningful log context. * Create logcontext for new scope. Instead of having a stack of scopes in a logcontext we create a new context for a new scope if the current logcontext already has a scope. * Remove scope from logcontext if logcontext is top level * Disable tracer if not configured * typo * Remove dependence on jaeger internals * bools * Set service name * :Explicitely state that the tracer is disabled * Black is the new black * Newsfile * Code style * Use the new config setup. * Generate config. * Copyright * Rename config to opentracing * Remove user whitelisting * Empty whitelist by default * User ConfigError instead of RuntimeError * Use isinstance * Use tag constants for opentracing. * Remove debug comment and no need to explicitely record error * Two errors a "s(c)entry" * Docstrings! * Remove debugging brainslip * Homeserver Whitlisting * Better opentracing config comment * linting * Inclue worker name in service_name * Make opentracing an optional dependency * Neater config retreival * Clean up dummy tags * Instantiate tracing as object instead of global class * Inlcude opentracing as a homeserver member. * Thread opentracing to the request level * Reference opetnracing through hs * Instantiate dummy opentracin g for tests. * About to revert, just keeping the unfinished changes just in case * Revert back to global state, commit number: 9ce4a3d9067bf9889b86c360c05ac88618b85c4f * Use class level methods in tracerutils * Start and stop requests spans in a place where we have access to the authenticated entity * Seen it, isort it * Make sure to close the active span. * I'm getting black and blue from this. * Logger formatting Co-Authored-By: Erik Johnston <erik@matrix.org> * Outdated comment * Import opentracing at the top * Return a contextmanager * Start tracing client requests from the servlet * Return noop context manager if not tracing * Explicitely say that these are federation requests * Include servlet name in client requests * Use context manager * Move opentracing to logging/ * Seen it, isort it again! * Ignore twisted return exceptions on context exit * Escape the scope * Scopes should be entered to make them useful. * Nicer decorator names * Just one init, init? * Don't need to close something that isn't open * Docs make you smarter
2019-07-11Inline issue_access_token (#5659)Richard van der Hoff3-8/+5
this is only used in one place, so it's clearer if we inline it and reduce the API surface. Also, fixes a buglet where we would create an access token even if we were about to block the user (we would never return the AT, so the user could never use it, but it was still created and added to the db.)
2019-07-10Remove access-token support from RegistrationStore.register (#5642)Richard van der Hoff9-79/+30
The 'token' param is no longer used anywhere except the tests, so let's kill that off too.
2019-07-10TypoBrendan Abolivier1-1/+1
2019-07-10Rename changelog fileBrendan Abolivier1-0/+0
2019-07-10Send 3PID bind requests as JSON dataBrendan Abolivier2-1/+2
2019-07-10Don't bundle aggregations when retrieving the original event (#5654)Andrew Morgan2-2/+13
A fix for PR #5626, which returned the original event content as part of a call to /relations. Only problem was that we were attempting to aggregate the relations on top of it when we did so. We now set bundle_aggregations to False in the get_event call. We also do this when pulling the relation events as well, because edits of edits are not something we'd like to support here.
2019-07-10Add a linting script (#5627)Andrew Morgan2-0/+13
Add a dev script to cover all the different linting steps.
2019-07-10