Commit graph

2255 commits

Author SHA1 Message Date
strawberry
54887fd0cf fix room ID messages, remove comments
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-24 21:09:07 -05:00
strawberry
3a80e32ba1 assume well-known is None if text length exceeds 10000 chars
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-24 21:07:53 -05:00
Charles Hall
5de3fb4502 move resolver logic into the resolver
Honestly not sure why it wasn't done like this before. This code is much
less awkward to follow and more compartmentalized.

These changes were mainly motivated by a clippy lint triggering on the
original code, which then made me wonder if I could get rid of some of
the `Box`ing. Turns out I could, and this is the result of that.

Co-authored-by: strawberry <strawberry@puppygock.gay>
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-24 18:41:03 -05:00
strawberry
916e160148 use both is_ip_literal and IPAddress is_valid checks
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-24 18:34:41 -05:00
strawberry
a1869444f5 just remove double quotes if found instead
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-24 18:16:25 -05:00
strawberry
99e72f8f63 custom room ID checks, dont use format! macro due to quotes being added
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-24 16:48:10 -05:00
strawberry
fa56f48ff2 check if room ID already exists instead of erroring on auth check
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-24 16:45:09 -05:00
strawberry
3d3389e946 additional character check on room alias
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-24 16:44:37 -05:00
strawberry
9fc0a3ccc4 update DIFFERENCES.md
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-24 15:51:33 -05:00
strawberry
d1d37d148a IP range denylist logging, and fix logic error
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-24 15:51:13 -05:00
strawberry
b8d3fb89fb add custom room ID support using room_id field
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-24 12:21:18 -05:00
strawberry
d82b9f3ec4 move room creation config check higher up
dont bother wasting resources if we know we
arent even allowed to make the room to begin with

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-24 12:18:49 -05:00
strawberry
c33a35e821 dont crash failing to deserialise room creation content
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-24 12:17:54 -05:00
strawberry
cef8fe6f6e add error checking to room aliases
length, colon, and spaces. also dont crash.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-24 12:17:12 -05:00
strawberry
ef225e86c4 remove random space
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-24 12:15:49 -05:00
strawberry
f61b5c7fa9 send home_server on login response again
a 6+ year old deprecated field that isnt even spelled
right, and no clients use it must still be sent
according to spec

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-24 12:15:23 -05:00
strawberry
0b65a362ae update deps
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-24 12:12:32 -05:00
strawberry
69e3de5aaa delete Dockerfile
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-24 12:12:21 -05:00
strawberry
3433e6ef66 don't send requests to specified list of IP CIDRs
this can most definitely be improved but this is a decent attempt.
the only annoying this is i couldn't just use a Vec<IPAddress> which
would have significantly simplified all of this, but serde can't
deserialise it on the config side i guess.

i may find a better way to do this in the future, but this should cover
most areas anyways.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-22 00:00:35 -05:00
strawberry
6199e438af oops forgot that endpoint too
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-21 20:34:31 -05:00
strawberry
bbf7387403 eat less of client parameters for media requests
still cantt respect allow_redirect yet

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-21 20:30:39 -05:00
strawberry
06ca17adf3 switch back to expect for sender_user
as far as i can tell, it will return a normal
error in the auth token handling code so this is fine.
we also shouldnt assume all errors from this are
access_token related.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-21 20:30:09 -05:00
strawberry
cfe338081c match explicit URI to see if we should authenticate the user
first attempt at forcing an endpoint to be authenticated

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-21 18:18:21 -05:00
strawberry
6ab2a1c56f update DIFFERENCES.md so far
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-21 18:17:29 -05:00
strawberry
dbd0959706 bump ruma, rusqlite, and rocksdb
latest rocksdb now has WriteBufferManager support

i hope no one is using sqlite with conduwuit, but if they are let's
bump it to latest git too for the latest sqlite version available.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-21 16:05:38 -05:00
strawberry
f48b5ae49f use ruma JsOption, bump figment
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-21 15:43:42 -05:00
strawberry
88d6d7e856 add warning about outgoing presence PDU/EDU relationship
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-21 13:45:14 -05:00
strawberry
973c4fe31d use engage for gitlab CI
from https://gitlab.com/famedly/conduit/-/merge_requests/564

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-20 22:49:21 -05:00
strawberry
ce24b509cf return joined member count of room for pushrules instead of hardcoded 10
im not sure what the TODO is trying to say here,
but since it's many years old and conduwuit is
fast, i dont see an issue with this.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-20 19:51:39 -05:00
strawberry
13af7e30ad silence loud tower_http errors (move to info)
these are benign errors that are from things like
conduwuit fetching remote media from dead servers

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-20 19:03:40 -05:00
strawberry
968e6e6100 support sending well_known client response in /login using well_known_client
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-20 19:02:44 -05:00
strawberry
fd92ffa9b4 send avatar_url on invite member events like synapse
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-20 12:44:17 -05:00
strawberry
7034693c42 fix obvious copy-paste error
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-20 12:37:29 -05:00
strawberry
8622ceb1fc add conduwuit-example.toml (new example config)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-18 01:08:25 -05:00
strawberry
ba49a22f22 revamp example config, document lots of config options
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-18 01:07:29 -05:00
strawberry
d63ded74a0 make warning and slight changes to DEPLOY.md for conduwuit
this is not finished yet

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-18 01:07:15 -05:00
strawberry
d93efb2d3a remove rocksdb_max_open_files option
default for RocksDB is -1 and conduwuit already raises the
soft and hard nofile limits at startup.

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-18 01:06:45 -05:00
strawberry
6ffc54e241 support blocking servers from fetching remote media from
akin to synapse's `prevent_media_downloads_from`

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 23:57:45 -05:00
strawberry
1a06c8c9d3 more error checking for deserialising events and canonical JSON
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 23:57:45 -05:00
strawberry
c83acabfb0 return proper error if we fail to convert to canonical JSON
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 23:57:45 -05:00
strawberry
3d6b499b88 log error and PDU for failed auth checks
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 23:57:45 -05:00
strawberry
3ffca25f6f update few endpoint docs versions
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 23:57:45 -05:00
strawberry
2bbc75d68e why did i have to run cargo fmt twice
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 14:26:26 -05:00
strawberry
de303d9480 update rust toolchain in flake
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 14:26:26 -05:00
strawberry
40f5345586 fix formatting and links of user reports more
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 14:26:26 -05:00
strawberry
6063a671c3 bump MSRV to 1.75.0 for latest ruma
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 14:26:26 -05:00
strawberry
632276ae99 bump ruma to aa3acd88d21dfbb7595f54e619f52761bcb0259e
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 14:26:26 -05:00
strawberry
e944ed5eb4 fix /report endpoint a lot
in short, the `/report` endpoint now checks if:
- the reporting room in the URI matches the PDU/event reported
- sender user is in the room reported
- raises report reasoning to 750 characters (spec doesn't say to limit
these, but thorough and informative reports for server admins are not
a bad thing)
- (hopefully) fixes some broken formatting
- add a random short delay before sending a successful response to the
client to make it more annoying to enumerate for events on our server
(security by obscurity but spec suggests it)

basically, secure reports better lol

see https://spec.matrix.org/v1.9/client-server-api/#post_matrixclientv3roomsroomidreporteventid

Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 14:26:26 -05:00
strawberry
7eb57a9fd5 explicitly fallback to None for invalid/empty room topics
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 14:26:26 -05:00
strawberry
1f117582ca update all transitive dependencies (cargo update)
Signed-off-by: strawberry <strawberry@puppygock.gay>
2024-01-17 14:26:26 -05:00