Steven Hammerton
dd2eb49385
Share more code between macaroon validation
2015-11-11 11:12:35 +00:00
Daniel Wagner-Hall
2cebe53545
Exchange 3pid invites for m.room.member invites
2015-11-05 16:43:19 +00:00
Daniel Wagner-Hall
f522f50a08
Allow guests to register and call /events?room_id=
...
This follows the same flows-based flow as regular registration, but as
the only implemented flow has no requirements, it auto-succeeds. In the
future, other flows (e.g. captcha) may be required, so clients should
treat this like the regular registration flow choices.
2015-11-04 17:29:07 +00:00
Daniel Wagner-Hall
e60dad86ba
Reject events which are too large
...
SPEC-222
2015-10-22 11:44:31 +01:00
Daniel Wagner-Hall
137fafce4e
Allow rejecting invites
...
This is done by using the same /leave flow as you would use if you had
already accepted the invite and wanted to leave.
2015-10-20 11:58:58 +01:00
Daniel Wagner-Hall
0e5239ffc3
Stuff signed data in a standalone object
...
Makes both generating it in sydent, and verifying it here, simpler at
the cost of some repetition
2015-10-16 17:45:48 +01:00
Daniel Wagner-Hall
c225d63e9e
Add signing host and keyname to signatures
2015-10-16 15:07:56 +01:00
Daniel Wagner-Hall
b8dd5b1a2d
Verify third party ID server certificates
2015-10-16 14:54:54 +01:00
Daniel Wagner-Hall
0c38e8637f
Remove unnecessary class-wrapping
2015-10-13 18:00:38 +01:00
Daniel Wagner-Hall
95e53ac535
Add some docstring
2015-10-13 17:18:24 +01:00
Daniel Wagner-Hall
17dffef5ec
Move event contents into third_party_layout field
2015-10-13 15:48:12 +01:00
Daniel Wagner-Hall
1cacc71050
Add third party invites to auth_events for joins
2015-10-06 10:13:28 -05:00
Daniel Wagner-Hall
58e6a58eb7
Merge branch 'develop' into daniel/3pidinvites
2015-10-05 10:33:41 -05:00
Erik Johnston
d5e081c7ae
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/unfederatable
2015-10-02 10:33:49 +01:00
Daniel Wagner-Hall
5b3e9713dd
Implement third party identifier invites
2015-10-01 17:49:52 +01:00
Mark Haines
ee2d722f0f
Merge pull request #276 from matrix-org/markjh/history_for_rooms_that_have_been_left
...
SPEC-216: Allow users to view the history of rooms that they have left.
2015-09-21 14:38:13 +01:00
Mark Haines
8e3bbc9bd0
Clarify which event is returned by check_user_was_in_room
2015-09-21 13:47:44 +01:00
Daniel Wagner-Hall
728d07c8c1
Merge pull request #256 from matrix-org/auth
...
Attempt to validate macaroons
2015-09-14 18:09:33 +01:00
Erik Johnston
d59acb8c5b
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/unfederatable
2015-09-14 18:05:31 +01:00
Erik Johnston
91cb3b630d
Merge pull request #265 from matrix-org/erikj/check_room_exists
...
Check room exists when authenticating an event
2015-09-14 17:56:18 +01:00
Mark Haines
1d579df664
Allow rooms/{roomId}/state for a room that has been left
2015-09-09 14:12:24 +01:00
Mark Haines
89ae0166de
Allow room initialSync for users that have left the room, returning a snapshot of how the room was when they left it
2015-09-09 13:25:22 +01:00
Erik Johnston
9b05ef6f39
Also check the domains for membership state_keys
2015-09-01 16:17:25 +01:00
Erik Johnston
187320b019
Merge branch 'erikj/check_room_exists' into erikj/unfederatable
2015-09-01 15:58:10 +01:00
Erik Johnston
b345853918
Check against sender rather than event_id
2015-09-01 15:57:35 +01:00
Erik Johnston
a88e16152f
Add flag which disables federation of the room
2015-09-01 15:47:30 +01:00
Erik Johnston
00149c063b
Fix tests
2015-09-01 15:42:03 +01:00
Erik Johnston
ab9e01809d
Check room exists when authenticating an event, by asserting they reference a creation event
2015-09-01 15:21:24 +01:00
Daniel Wagner-Hall
e255c2c32f
s/user_id/user/g for consistency
2015-09-01 12:41:16 +01:00
Daniel Wagner-Hall
b854a375b0
Check domain of events properly
...
Federated servers still need to delegate authority to owning servers
2015-09-01 11:53:31 +01:00
Daniel Wagner-Hall
8256a8ece7
Allow users to redact their own events
2015-08-28 15:31:49 +01:00
Daniel Wagner-Hall
6a4b650d8a
Attempt to validate macaroons
...
A couple of weird caveats:
* If we can't validate your macaroon, we fall back to checking that
your access token is in the DB, and ignoring the failure
* Even if we can validate your macaroon, we still have to hit the DB to
get the access token ID, which we pretend is a device ID all over the
codebase.
This mostly adds the interesting code, and points out the two pieces we
need to delete (and necessary conditions) in order to fix the above
caveats.
2015-08-26 13:22:23 +01:00
Daniel Wagner-Hall
a9d8bd95e7
Stop looking up "admin", which we never read
2015-08-25 16:29:39 +01:00
Daniel Wagner-Hall
57619d6058
Re-wrap line
2015-08-25 16:25:46 +01:00
Daniel Wagner-Hall
a0b181bd17
Remove completely unused concepts from codebase
...
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.
2015-08-25 16:23:06 +01:00
Daniel Wagner-Hall
13a6517d89
s/by_token/by_access_token/g
...
We're about to have two kinds of token, access and refresh
2015-08-20 16:01:29 +01:00
Erik Johnston
ee59af9ac0
Set request.authenticated_entity for application services
2015-08-18 15:17:47 +01:00
Daniel Wagner-Hall
45610305ea
Add missing space because linter
2015-08-11 16:43:27 +01:00
Daniel Wagner-Hall
88e03da39f
Minor docs cleanup
2015-08-11 16:35:28 +01:00
Daniel Wagner-Hall
9dba813234
Remove redundant if-guard
...
The startswith("@") does the job
2015-08-11 16:34:17 +01:00
Erik Johnston
016c089f13
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/power_level_sanity
2015-07-13 13:48:13 +01:00
Erik Johnston
a5ea22d468
Sanitize power level checks
2015-07-10 14:05:38 +01:00
Erik Johnston
7e3b14fe78
You shouldn't be able to ban/kick users with higher power levels
2015-07-10 14:05:38 +01:00
Erik Johnston
1a3255b507
Add m.room.history_visibility to newly created rooms' m.room.power_levels
2015-07-06 13:25:35 +01:00
Erik Johnston
00ab882ed6
Add m.room.history_visibility to list of auth events
2015-07-03 10:31:24 +01:00
Erik Johnston
cee69441d3
Log more when we have processed the request
2015-06-15 17:11:44 +01:00
Erik Johnston
22c7c5eb8f
Typo
2015-05-01 14:41:25 +01:00
Erik Johnston
42c12c04f6
Remove some run_on_reactors
2015-05-01 14:41:25 +01:00
Erik Johnston
adb5b76ff5
Don't log all auth events every time we call auth.check
2015-05-01 14:41:25 +01:00
Erik Johnston
80b4119279
Don't wait for storage of access_token
2015-05-01 13:14:05 +01:00
Mark Haines
9182f87664
Merge pull request #126 from matrix-org/csauth
...
Client / Server Auth Refactor
2015-04-28 11:00:27 +01:00
Paul "LeoNerd" Evans
38432d8c25
Merge branch 'develop' into invite_power_level
2015-04-27 17:09:25 +01:00
David Baker
6532b6e607
Merge branch 'develop' into csauth
...
Conflicts:
synapse/http/server.py
2015-04-24 09:37:54 +01:00
David Baker
a2c10d37d7
Add an error code to 'missing token' response.
2015-04-23 13:23:44 +01:00
Paul "LeoNerd" Evans
a16eaa0c33
Neater fetching of user's auth level in a room - squash to int() at access time (SYN-353)
2015-04-22 14:20:04 +01:00
Paul "LeoNerd" Evans
f43063158a
Appease pep8
2015-04-22 13:12:11 +01:00
Paul "LeoNerd" Evans
2808c040ef
Also remember to check 'invite' level for changes
2015-04-21 21:13:14 +01:00
Paul "LeoNerd" Evans
bc41f0398f
Initial implementation of an 'invite' power_level
2015-04-21 20:56:08 +01:00
Paul "LeoNerd" Evans
d3309933f5
Much neater fetching of defined powerlevels from m.room.power_levels state event
2015-04-21 20:53:23 +01:00
Paul "LeoNerd" Evans
b568c0231c
Remove debugging print statement accidentally committed
2015-04-21 20:21:14 +01:00
Paul "LeoNerd" Evans
3a7d7a3f22
Sanitise a user's powerlevel to an int() before numerical comparison, because otherwise Python is "helpful" with it (SYN-351)
2015-04-21 20:18:29 +01:00
David Baker
cb03fafdf1
Merge branch 'develop' into csauth
2015-04-17 13:51:10 +01:00
Paul "LeoNerd" Evans
399b5add58
Neater implementation of membership change auth checks, ensuring we can't forget to check if the calling user is a member of the room
2015-04-15 18:40:23 +01:00
Paul "LeoNerd" Evans
e6e130b9ba
Ensure that non-room-members cannot ban others, even if they do have enough powerlevel (SYN-343)
2015-04-15 18:07:33 +01:00
Kegan Dougal
ae8ff92e05
Fix a bug which causes a send event level of 0 to not be honoured.
...
Caused by a bad if check, which incorrectly executes for both 0 and None,
when None was the original intent.
2015-04-07 15:48:20 +01:00
David Baker
9aa0224cdf
unused import
2015-03-24 17:25:59 +00:00
David Baker
c7023f2155
1) Pushers are now associated with an access token
...
2) Change places where we mean unauthenticated to 401, not 403, in C/S v2: hack so it stays as 403 in v1 because web client relies on it.
2015-03-24 17:24:15 +00:00
Paul "LeoNerd" Evans
93978c5e2b
@cached() annotate get_user_by_token() - achieves a minor DB performance improvement
2015-03-17 17:24:51 +00:00
Erik Johnston
b2e6ee5b43
Remove concept of context.auth_events, instead use context.current_state
2015-03-16 13:06:23 +00:00
Erik Johnston
ea8590cf66
Make context.auth_events grap auth events from current state. Otherwise auth is wrong.
2015-03-16 00:18:08 +00:00
Erik Johnston
ab8229479b
Respect ban membership
2015-03-16 00:17:25 +00:00
Kegan Dougal
9978c5c103
Merge branch 'develop' into application-services
2015-02-11 10:03:24 +00:00
Erik Johnston
d94f682a4c
During room intial sync, only calculate current state once.
2015-02-09 17:41:29 +00:00
Kegan Dougal
5a7dd05818
Modify auth.get_user_by_req for authing appservices directly.
...
Add logic to map the appservice token to the autogenned appservice user ID.
Add unit tests for all forms of get_user_by_req (user/appservice,
valid/bad/missing tokens)
2015-02-09 14:14:15 +00:00
Kegan Dougal
e426df8e10
Grant ASes the ability to create alias in their own namespace.
...
Add a new errcode type M_EXCLUSIVE when users try to create aliases inside
AS namespaces, and when ASes try to create aliases outside their own
namespace.
2015-02-06 10:57:14 +00:00
Kegan Dougal
5b99b471b2
Fix unit tests.
2015-02-05 15:12:36 +00:00
Kegan Dougal
c163357f38
Add CS extension for masquerading as users within the namespaces specified by the AS.
2015-02-05 15:00:33 +00:00
Erik Johnston
650e32d455
Change context.auth_events to what the auth_events would be bases on context.current_state, rather than based on the auth_events from the event.
2015-02-04 14:06:46 +00:00
Erik Johnston
0dd3aea319
Keep around the old (buggy) version of the prune_event function so that we can use it to check signatures for events on old servers
2015-02-03 14:58:30 +00:00
Erik Johnston
a70a801184
Fix bug where we superfluously asked for current state. Change API of /query_auth/ so that we don't duplicate events in the response.
2015-01-30 13:34:01 +00:00
Erik Johnston
2ebf795c0a
Merge branch 'develop' of github.com:matrix-org/synapse into rejections
...
Conflicts:
synapse/storage/__init__.py
synapse/storage/schema/delta/v12.sql
2015-01-30 11:10:37 +00:00
Mark Haines
3cca61e006
Rename ClientID to ClientInfo since it is a pair of IDs rather than a single identifier
2015-01-28 17:16:12 +00:00
Mark Haines
c18e551640
Add a : to the doc string after the type of the return value
2015-01-28 17:08:53 +00:00
Mark Haines
388581e087
Extract the id token of the token when authing users, include the token and device_id in the internal meta data for the event along with the transaction id when sending events
2015-01-28 16:58:23 +00:00
Erik Johnston
0ef5bfd6a9
Start implementing auth conflict res
2015-01-28 16:16:53 +00:00
Mark Haines
c59bcabf0b
Return the device_id from get_auth_by_req
2015-01-28 15:43:41 +00:00
Mark Haines
5759bec43c
Replace hs.parse_userid with UserID.from_string
2015-01-23 11:47:15 +00:00
Kegan Dougal
4c68460392
SYN-154: Tweak how the m.room.create check is done.
...
Don't perform the check in auth.is_host_in_room but instead do it in _do_join
and also assert that there are no m.room.members in the room before doing so.
2015-01-07 16:09:00 +00:00
Kegan Dougal
9cb4f75d53
SYN-154: Better error messages when joining an unknown room by ID.
...
The simple fix doesn't work here because room creation also involves
unknown room IDs. The check relies on the presence of m.room.create for
rooms being created, whereas bogus room IDs have no state events at all.
2015-01-07 15:21:48 +00:00
Mark Haines
adb04b1e57
Update copyright notices
2015-01-06 13:21:39 +00:00
Erik Johnston
fc409096ac
Make auth module use EventTypes constants
2014-12-12 16:31:50 +00:00
Erik Johnston
fa4b610ae3
Fix stream test. Make sure we add join to auth_events for invitiations
2014-12-12 10:42:27 +00:00
Erik Johnston
ba3d1e2fc0
Remove unused import
2014-12-08 12:01:25 +00:00
Erik Johnston
d044121168
Various typos and bug fixes.
2014-12-08 09:08:26 +00:00
Erik Johnston
6630e1b579
Start making more things use EventContext rather than event.*
2014-12-05 16:20:48 +00:00
Erik Johnston
5d7c9ab789
Begin converting things to use the new Event structure
2014-12-04 11:27:59 +00:00
Erik Johnston
75b4329aaa
WIP for new way of managing events.
2014-12-03 16:07:21 +00:00
Erik Johnston
027542e2e5
Fix bugs when joining a remote room that has dodgy event graphs. This should also fix the number of times a HS will trigger a GET /event/
2014-11-27 16:02:26 +00:00
Erik Johnston
64fc859dac
Fix bugs in invite/join dances.
...
We now do more implement more of the auth on the events so that we
don't reject valid events.
2014-11-25 17:59:49 +00:00
Erik Johnston
e549aac127
Add missing None check
2014-11-24 13:47:58 +00:00
Mark Haines
db9ce032a4
Fix pep8 codestyle warnings
2014-11-20 17:26:36 +00:00
Erik Johnston
512993b57f
Only users can set state events which have their own user_id
2014-11-19 17:22:37 +00:00
Mark Haines
3553101eb3
Null check when determining default power levels
2014-11-18 15:43:17 +00:00
Erik Johnston
95614e5220
Fix auth to correctly handle initial creation of rooms
2014-11-18 15:36:41 +00:00
Erik Johnston
6fea478d2e
Fix bugs with invites/joins across federatiom.
...
Both in terms of auth and not trying to fetch missing PDUs for invites,
joins etc.
2014-11-12 11:24:11 +00:00
Erik Johnston
a8e565eca8
Add an EventValidator. Fix bugs in auth ++ storage
2014-11-10 18:25:42 +00:00
Erik Johnston
5d439b127b
PEP8
2014-11-10 13:46:44 +00:00
Erik Johnston
6447db063a
Fix backfill to work. Add auth to backfill request
2014-11-10 11:59:51 +00:00
Erik Johnston
65f846ade0
Notify users about invites.
2014-11-10 11:15:02 +00:00
Erik Johnston
407d8a5019
Fix invite auth
2014-11-10 10:35:43 +00:00
Erik Johnston
49948d72f3
Fix joining over federation
2014-11-07 10:53:38 +00:00
Erik Johnston
bf6b72eb55
Start implementing auth chains
2014-11-07 10:53:38 +00:00
Erik Johnston
8421cabb9d
Neaten things up a bit
2014-11-07 10:53:38 +00:00
Erik Johnston
351c64e99e
Amalgamate all power levels.
...
Remove concept of reqired power levels, something similiar can be done
using the new power level event.
2014-11-06 16:59:13 +00:00
Erik Johnston
96c001e668
Fix auth checks to all use the given old_event_state
2014-11-05 11:07:54 +00:00
Erik Johnston
4a1597f295
Fix bug in redaction auth.
...
This caused a 500 when sending a redaction due to a typo in a method
invocation.
2014-10-31 09:48:59 +00:00
Erik Johnston
b3b1961496
Fix bug where people could join private rooms
2014-10-17 19:37:41 +01:00
Erik Johnston
5ffe5ab43f
Use state groups to get current state. Make join dance actually work.
2014-10-17 18:56:42 +01:00
Erik Johnston
f71627567b
Finish implementing the new join dance.
2014-10-17 15:04:17 +01:00
Erik Johnston
1116f5330e
Start implementing the invite/join dance. Continue moving auth to use event.state_events
2014-10-16 16:56:51 +01:00
Erik Johnston
e7bc1291a0
Begin making auth use event.old_state_events
2014-10-15 16:06:59 +01:00
Erik Johnston
7151615260
Update docstring
2014-09-29 15:35:54 +01:00
Erik Johnston
3ccb17ce59
SYN-48: Implement WHOIS rest servlet
2014-09-29 14:59:52 +01:00
Erik Johnston
c65306f877
Add auth check to test if a user is an admin or not.
2014-09-29 13:35:38 +01:00
Erik Johnston
f7d80930f2
SYN-48: Track User-Agents as well as IPs for client devices.
2014-09-29 13:35:15 +01:00
Erik Johnston
0fdf308874
Track the IP users connect with. Add an admin column to users table.
2014-09-26 16:36:24 +01:00
Erik Johnston
37bfe44046
Merge branch 'deletions' of github.com:matrix-org/synapse into develop
2014-09-25 17:02:53 +01:00
Erik Johnston
327dcc98e3
SYN-70: And fix another bug where I can't type
2014-09-24 16:19:29 +01:00
Erik Johnston
87deaf1658
SYN-70: Fix typo
2014-09-24 16:15:58 +01:00
Erik Johnston
70899d3ab2
Rename deletions to redactions
2014-09-24 15:27:59 +01:00
Erik Johnston
bc250a6afa
SYN-12: Implement auth for deletion by adding a 'delete_level' on the ops levels event
...
SYN-12 # comment Auth has been added.
2014-09-23 17:36:24 +01:00
Erik Johnston
480438eee6
Validate power levels event changes. Change error messages to be more helpful. Fix bug where we checked the wrong power levels
2014-09-05 21:54:16 +01:00
Erik Johnston
9dd4570b68
Generate m.room.aliases event when the HS creates a room alias
2014-09-05 21:35:56 +01:00
Erik Johnston
250ee2ea7d
AUth the contents of power level events
2014-09-05 17:13:19 +01:00
Erik Johnston
95037d8d9d
Change the default power levels to be 0, 50 and 100
2014-09-05 17:13:03 +01:00
Matthew Hodgson
8a7c1d6a00
fix the copyright holder from matrix.org to OpenMarket Ltd, as matrix.org hasn't been incorporated in time for launch.
2014-09-03 17:31:57 +01:00
Erik Johnston
4b8244fbf8
Fix bug where we didn't correctly store the ops power levels event.
2014-09-02 12:12:14 +01:00
Erik Johnston
db02021aba
Implement auth for kicking.
2014-09-02 10:58:33 +01:00
Erik Johnston
b8ab9f1c0a
Add all the necessary checks to make banning work.
2014-09-01 18:24:56 +01:00
Erik Johnston
db7109c43b
Add beginnings of ban support.
2014-09-01 16:15:34 +01:00
Erik Johnston
865469f233
Implement power level lists, default power levels and send_evnet_level/add_state_level events.
2014-09-01 14:39:09 +01:00
Mark Haines
b30358f439
add _get_room_member, fix datastore methods
2014-08-27 16:51:54 +01:00
Mark Haines
bf05218c4b
Merge branch 'develop' into storage_transactions
2014-08-27 11:19:37 +01:00
Kegan Dougal
dfa0cd1d90
Modified /join/$identifier to support $identifier being a room ID in addition to a room alias.
2014-08-27 09:43:42 +01:00
Mark Haines
4b63b06cad
Merge branch 'develop' into storage_transactions
...
Conflicts:
synapse/api/auth.py
synapse/handlers/room.py
synapse/storage/__init__.py
2014-08-26 16:07:05 +01:00
Mark Haines
ac21dfff6d
Fix pyflakes errors
2014-08-26 16:02:59 +01:00
Kegan Dougal
cab3095803
Removed member list servlet: now using generic state paths.
2014-08-26 09:26:07 +01:00
Mark Haines
1379dcae6f
Take a snapshot of the state of the room before performing updates
2014-08-22 17:00:10 +01:00
Kegan Dougal
f690b7b827
Impl: /rooms/roomid/state/eventtype/state_key - Renamed RoomTopicRestServlet to RoomStateEventRestServlet. Support generic state event sending.
2014-08-22 15:59:15 +01:00
Kegan Dougal
61933f8e52
Added M_UNKNOWN_TOKEN error code and send it when there is an unrecognised access_token
2014-08-14 13:47:39 +01:00