Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/re…
Browse files Browse the repository at this point in the history
…move_auth
  • Loading branch information
erikjohnston committed Oct 17, 2016
2 parents 2869a29 + a68ade6 commit 816988b
Show file tree
Hide file tree
Showing 80 changed files with 2,949 additions and 1,379 deletions.
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ homeserver*.yaml
.coverage
htmlcov

demo/*.db
demo/*.log
demo/*.log.*
demo/*.pid
demo/*/*.db
demo/*/*.log
demo/*/*.log.*
demo/*/*.pid
demo/media_store.*
demo/etc

Expand Down
83 changes: 83 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,86 @@
Changes in synapse v0.18.1 (2016-10-0)
======================================

No changes since v0.18.1-rc1


Changes in synapse v0.18.1-rc1 (2016-09-30)
===========================================

Features:

* Add total_room_count_estimate to ``/publicRooms`` (PR #1133)


Changes:

* Time out typing over federation (PR #1140)
* Restructure LDAP authentication (PR #1153)


Bug fixes:

* Fix 3pid invites when server is already in the room (PR #1136)
* Fix upgrading with SQLite taking lots of CPU for a few days
after upgrade (PR #1144)
* Fix upgrading from very old database versions (PR #1145)
* Fix port script to work with recently added tables (PR #1146)


Changes in synapse v0.18.0 (2016-09-19)
=======================================

The release includes major changes to the state storage database schemas, which
significantly reduce database size. Synapse will attempt to upgrade the current
data in the background. Servers with large SQLite database may experience
degradation of performance while this upgrade is in progress, therefore you may
want to consider migrating to using Postgres before upgrading very large SQLite
databases


Changes:

* Make public room search case insensitive (PR #1127)


Bug fixes:

* Fix and clean up publicRooms pagination (PR #1129)


Changes in synapse v0.18.0-rc1 (2016-09-16)
===========================================

Features:

* Add ``only=highlight`` on ``/notifications`` (PR #1081)
* Add server param to /publicRooms (PR #1082)
* Allow clients to ask for the whole of a single state event (PR #1094)
* Add is_direct param to /createRoom (PR #1108)
* Add pagination support to publicRooms (PR #1121)
* Add very basic filter API to /publicRooms (PR #1126)
* Add basic direct to device messaging support for E2E (PR #1074, #1084, #1104,
#1111)


Changes:

* Move to storing state_groups_state as deltas, greatly reducing DB size (PR
#1065)
* Reduce amount of state pulled out of the DB during common requests (PR #1069)
* Allow PDF to be rendered from media repo (PR #1071)
* Reindex state_groups_state after pruning (PR #1085)
* Clobber EDUs in send queue (PR #1095)
* Conform better to the CAS protocol specification (PR #1100)
* Limit how often we ask for keys from dead servers (PR #1114)


Bug fixes:

* Fix /notifications API when used with ``from`` param (PR #1080)
* Fix backfill when cannot find an event. (PR #1107)


Changes in synapse v0.17.3 (2016-09-09)
=======================================

Expand Down
1 change: 1 addition & 0 deletions docs/workers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ The current available worker applications are:
* synapse.app.appservice - handles output traffic to Application Services
* synapse.app.federation_reader - handles receiving federation traffic (including public_rooms API)
* synapse.app.media_repository - handles the media repository.
* synapse.app.client_reader - handles client API endpoints like /publicRooms

Each worker configuration file inherits the configuration of the main homeserver
configuration file. You can then override configuration specific to that worker,
Expand Down
2 changes: 2 additions & 0 deletions jenkins-dendron-postgres.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ export SYNAPSE_CACHE_FACTOR=1
--pusher \
--synchrotron \
--federation-reader \
--client-reader \
--appservice \
4 changes: 3 additions & 1 deletion res/templates/notif_mail.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
<div class="summarytext">{{ summary_text }}</div>
</td>
<td class="logo">
{% if app_name == "Vector" %}
{% if app_name == "Riot" %}
<img src="http://matrix.org/img/riot-logo-email.png" width="83" height="83" alt="[Riot]"/>
{% elif app_name == "Vector" %}
<img src="http://matrix.org/img/vector-logo-email.png" width="64" height="83" alt="[Vector]"/>
{% else %}
<img src="http://matrix.org/img/matrix-120x51.png" width="120" height="51" alt="[matrix]"/>
Expand Down
9 changes: 9 additions & 0 deletions scripts/synapse_port_db
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ BOOLEAN_COLUMNS = {
"event_edges": ["is_state"],
"presence_list": ["accepted"],
"presence_stream": ["currently_active"],
"public_room_list_stream": ["visibility"],
}


Expand Down Expand Up @@ -71,6 +72,14 @@ APPEND_ONLY_TABLES = [
"event_to_state_groups",
"rejections",
"event_search",
"presence_stream",
"push_rules_stream",
"current_state_resets",
"ex_outlier_stream",
"cache_invalidation_stream",
"public_room_list_stream",
"state_group_edges",
"stream_ordering_to_exterm",
]


Expand Down
2 changes: 1 addition & 1 deletion synapse/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
""" This is a reference implementation of a Matrix home server.
"""

__version__ = "0.17.3"
__version__ = "0.18.1"
47 changes: 28 additions & 19 deletions synapse/api/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def check_from_context(self, event, context, do_sig_check=True):
auth_events = {
(e.type, e.state_key): e for e in auth_events.values()
}
self.check(event, auth_events=auth_events, do_sig_check=False)
self.check(event, auth_events=auth_events, do_sig_check=do_sig_check)

def check(self, event, auth_events, do_sig_check=True):
""" Checks if this event is correctly authed.
Expand All @@ -91,11 +91,28 @@ def check(self, event, auth_events, do_sig_check=True):
if not hasattr(event, "room_id"):
raise AuthError(500, "Event has no room_id: %s" % event)

sender_domain = get_domain_from_id(event.sender)
if do_sig_check:
sender_domain = get_domain_from_id(event.sender)
event_id_domain = get_domain_from_id(event.event_id)

is_invite_via_3pid = (
event.type == EventTypes.Member
and event.membership == Membership.INVITE
and "third_party_invite" in event.content
)

# Check the sender's domain has signed the event
if do_sig_check and not event.signatures.get(sender_domain):
raise AuthError(403, "Event not signed by sending server")
# Check the sender's domain has signed the event
if not event.signatures.get(sender_domain):
# We allow invites via 3pid to have a sender from a different
# HS, as the sender must match the sender of the original
# 3pid invite. This is checked further down with the
# other dedicated membership checks.
if not is_invite_via_3pid:
raise AuthError(403, "Event not signed by sender's server")

# Check the event_id's domain has signed the event
if not event.signatures.get(event_id_domain):
raise AuthError(403, "Event not signed by sending server")

if auth_events is None:
# Oh, we don't know what the state of the room was, so we
Expand Down Expand Up @@ -491,6 +508,9 @@ def _verify_third_party_invite(self, event, auth_events):
if not invite_event:
return False

if invite_event.sender != event.sender:
return False

if event.user_id != invite_event.user_id:
return False

Expand Down Expand Up @@ -633,7 +653,7 @@ def get_user_by_req(self, request, allow_guest=False, rights="access"):

@defer.inlineCallbacks
def _get_appservice_user_id(self, request):
app_service = yield self.store.get_app_service_by_token(
app_service = self.store.get_app_service_by_token(
get_access_token_from_request(
request, self.TOKEN_NOT_FOUND_HTTP_STATUS
)
Expand Down Expand Up @@ -835,13 +855,12 @@ def _look_up_user_by_access_token(self, token):
}
defer.returnValue(user_info)

@defer.inlineCallbacks
def get_appservice_by_req(self, request):
try:
token = get_access_token_from_request(
request, self.TOKEN_NOT_FOUND_HTTP_STATUS
)
service = yield self.store.get_app_service_by_token(token)
service = self.store.get_app_service_by_token(token)
if not service:
logger.warn("Unrecognised appservice access token: %s" % (token,))
raise AuthError(
Expand All @@ -850,7 +869,7 @@ def get_appservice_by_req(self, request):
errcode=Codes.UNKNOWN_TOKEN
)
request.authenticated_entity = service.sender
defer.returnValue(service)
return defer.succeed(service)
except KeyError:
raise AuthError(
self.TOKEN_NOT_FOUND_HTTP_STATUS, "Missing access token."
Expand Down Expand Up @@ -982,16 +1001,6 @@ def _can_send_event(self, event, auth_events):
403,
"You are not allowed to set others state"
)
else:
sender_domain = UserID.from_string(
event.user_id
).domain

if sender_domain != event.state_key:
raise AuthError(
403,
"You are not allowed to set others state"
)

return True

Expand Down
1 change: 1 addition & 0 deletions synapse/app/appservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ def run():
def start():
ps.replicate()
ps.get_datastore().start_profiling()
ps.get_state_handler().start_caching()

reactor.callWhenRunning(start)

Expand Down
Loading

0 comments on commit 816988b

Please sign in to comment.