Jonathan de Jong
4b965c862d
Remove redundant "coding: utf-8" lines ( #9786 )
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>`
před 3 roky
David Teller
f14428b25c
Allow spam-checker modules to be provide async methods. ( #8890 )
Spam checker modules can now provide async methods. This is implemented
in a backwards-compatible manner.
před 3 roky
Patrick Cloke
c619253db8
Stop sub-classing object ( #8249 )
před 3 roky
Dagfinn Ilmari Mannsåker
a3f11567d9
Replace all remaining six usage with native Python 3 equivalents ( #7704 )
před 3 roky
Patrick Cloke
bd6dc17221
Replace iteritems/itervalues/iterkeys with native versions. ( #7692 )
před 3 roky
Patrick Cloke
56b66db78a
Strictly enforce canonicaljson requirements in a new room version ( #7381 )
před 4 roky
Richard van der Hoff
39230d2171
Clean up some LoggingContext stuff ( #7120 )
* 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.
před 4 roky
Patrick Cloke
c2db6599c8
Fix a bug in the federation API which could cause occasional "Failed to get PDU" errors ( #7089 ).
před 4 roky
Patrick Cloke
7581d30e9f
Remove unused federation endpoint (`query_auth`) ( #7026 )
před 4 roky
Patrick Cloke
12d4259000
Add some type annotations to the federation base & client classes ( #6995 )
před 4 roky
Patrick Cloke
380122866f
Cast a coroutine into a Deferred in the federation base ( #6996 )
Properly convert a coroutine into a Deferred in federation_base to fix an error when joining a room.
před 4 roky
Richard van der Hoff
799001f2c0
Add a `make_event_from_dict` method ( #6858 )
... 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.
před 4 roky
Richard van der Hoff
928edef979
Pass room_version into `event_from_pdu_json`
It's called from all over the shop, so this one's a bit messy.
před 4 roky
Andrew Morgan
54fef094b3
Remove usage of deprecated logger.warn method from codebase ( #6271 )
Replace every instance of `logger.warn` with `logger.warning` as the former is deprecated.
před 4 roky
Richard van der Hoff
172f264ed3
Improve signature checking on some federation APIs ( #6262 )
Make sure that we check that events sent over /send_join, /send_leave, and
/invite, are correctly signed and come from the expected servers.
před 4 roky
Amber Brown
4806651744
Replace returnValue with return ( #5736 )
před 4 roky
Amber Brown
463b072b12
Move logging utilities out of the side drawer of util/ and into logging/ ( #5606 )
před 4 roky
Richard van der Hoff
2f8491daef
Fix logging error when a tampered event is detected. ( #5500 )
před 4 roky
Amber Brown
32e7c9e7f2
Run Black. ( #5482 )
před 4 roky
Richard van der Hoff
cea9750d11
Associate a request_name with each verify request, for logging
Also:
* rename VerifyKeyRequest->VerifyJsonRequest
* calculate key_ids on VerifyJsonRequest construction
* refactor things to pass around VerifyJsonRequests instead of 4-tuples
před 5 roky
Richard van der Hoff
14f13babb0
Add a test room version where we enforce key validity ( #5348 )
před 5 roky
Richard van der Hoff
fec2dcb1a5
Enforce validity period on server_keys for fed requests. ( #5321 )
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.
před 5 roky
Richard van der Hoff
837d7f85a9
more logging improvements
před 5 roky
Richard van der Hoff
fd8fb32bdd
remove extraneous exception logging
před 5 roky
Richard van der Hoff
7ca638c761
Clarify logging when PDU signature checking fails
před 5 roky
Richard van der Hoff
54a87a7b08
Collect room-version variations into one place ( #4969 )
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.
před 5 roky
Erik Johnston
0b24d58e05
No vdh tests!
před 5 roky
Erik Johnston
a1b0e1879b
Enable room version v3
před 5 roky
Erik Johnston
ff2f65d737
Update comment
před 5 roky
Erik Johnston
840068bd78
Only check event ID domain for signatures for V1 events
In future version events won't have an event ID, so we won't be able to
do this check.
před 5 roky
Erik Johnston
a50cf929c1
Require event format version to parse or create events
před 5 roky
Erik Johnston
be6a7e47fa
Revert "Require event format version to parse or create events"
před 5 roky
Erik Johnston
f431ff3fb8
Require event format version to parse or create events
před 5 roky
Erik Johnston
6a41d2a187
Add room_version param to get_pdu
When we add new event format we'll need to know the event format or room
version when parsing events.
před 5 roky
Erik Johnston
89a76d1889
Fix handling of redacted events from federation
If we receive an event that doesn't pass their content hash check (e.g.
due to already being redacted) then we hit a bug which causes an
exception to be raised, which then promplty stops the event (and
request) from being processed.
This effects all sorts of federation APIs, including joining rooms with
a redacted state event.
před 5 roky
Richard van der Hoff
cd7ef43872
clearer logging when things fail, too
před 5 roky
Richard van der Hoff
804dd41e18
Check that signatures on events are valid
We should check that both the sender's server, and the server which created the
event_id (which may be different from whatever the remote server has told us
the origin is), have signed the event.
před 5 roky
Krombel
3366b9c534
rename assert_params_in_request to assert_params_in_dict
the method "assert_params_in_request" does handle dicts and not
requests. A request body has to be parsed to json before this method
can be used
před 5 roky
Amber Brown
49af402019
run isort
před 5 roky
Richard van der Hoff
33f469ba19
Apply some limits to depth to counter abuse
* When creating a new event, cap its depth to 2^63 - 1
* When receiving events, reject any without a sensible depth
As per https://docs.google.com/document/d/1I3fi2S-XnpO45qrpCsowZv8P8dHcNZ4fsBsbOW7KABI
před 6 roky
Erik Johnston
e05bf34117
Move property setting from ReplicationLayer to FederationBase
před 6 roky
Richard van der Hoff
bd91857028
Check missing fields in event_from_pdu_json
Return a 400 rather than a 500 when somebody messes up their send_join
před 6 roky
Richard van der Hoff
3079f80d4a
Factor out `event_from_pdu_json`
turns out we have two copies of this, and neither needs to be an instance
method
před 6 roky
David Baker
6cd5fcd536
Make the spam checker a module
před 6 roky
Richard van der Hoff
6de74ea6d7
Fix logcontexts in _check_sigs_and_hashes
před 6 roky
Richard van der Hoff
fcf2c0fd1a
Remove redundant `preserve_fn`
preserve_fn is a no-op unless the wrapped function returns a
Deferred. verify_json_objects_for_server returns a list, so this is doing
nothing.
před 6 roky
Richard van der Hoff
5ed109d59f
PoC for filtering spammy events ( #2456 )
Demonstration of how you might add some hooks to filter out spammy events.
před 6 roky
Erik Johnston
9219139351
Preserve some logcontexts
před 7 roky
Erik Johnston
d41a1a91d3
Linearize fetching of gaps on incoming events
This potentially stops the server from doing multiple requests for the
same data.
před 8 roky
Matthew Hodgson
6c28ac260c
copyrights
před 8 roky