Commit Graph

459 Commits

Author SHA1 Message Date
gnuxie
a03640c8ac Redesign initialization API of many mjolnir.
It's much harder to forget to initialize the components now that you have to in order to construct them in the first place.
2022-11-15 17:05:30 +00:00
gnuxie
074a16bfaf limited access control
still needs hooking up when mjolnir restarts, and when the access control changes
2022-11-15 17:05:30 +00:00
gnuxie
c0ad6dab1c Add some much needed ergonomics to how the bridge is constructed. 2022-11-15 17:05:30 +00:00
gnuxie
4c434c6c30 allow appservice to be configured 2022-11-15 17:05:30 +00:00
jesopo
8771ca936d launch and use postgres in a container whilst using mx-tester 2022-11-15 17:05:30 +00:00
gnuxie
a0da2e1145 enable esModuleInterop 2022-11-15 17:05:30 +00:00
gnuxie
383d3fe25f remove unnecessary import 2022-11-15 17:05:30 +00:00
gnuxie
fb2868d815 tighter guard around room type in PolicyList
matrix-bot-sdk imporved the types for this
2022-11-15 17:05:30 +00:00
gnuxie
9781b6e982 idk why we had nedb in there for matrix-appservice-bridge 2022-11-15 17:05:30 +00:00
jesopo
8b1faf0877 reconstructing mjolnirs after a reboot works! 2022-11-15 17:05:30 +00:00
jesopo
f383a1c416 postgres db 2022-11-15 17:05:30 +00:00
gnuxie
efb4cebbd1 Refactor list creation 2022-11-15 17:05:30 +00:00
jesopo
9a49d29821 better name for policy room 2022-11-15 17:05:30 +00:00
jesopo
8ebe257146 warrior of light, use the echo 2022-11-15 17:05:30 +00:00
gnuxie
b075beed1a bleh yarn lock broke after rebase 2022-11-15 17:05:30 +00:00
jesopo
67557047c5 missing await on mjolnirManager.createNew 2022-11-15 17:05:30 +00:00
jesopo
ad6e787486 add /join endpoint to api backend 2022-11-15 17:05:30 +00:00
jesopo
039f64adb4 remove ratelimits from appservice mjolnirs 2022-11-15 17:05:30 +00:00
jesopo
f67f64e3cd shouldn't've changed this 2022-11-15 17:05:30 +00:00
jesopo
da006d74c5 use body-parser, bind api handlers 2022-11-15 17:05:30 +00:00
jesopo
caa079462a response statuses need bodies 2022-11-15 17:05:30 +00:00
jesopo
3c4eb5ffa3 update MjolnirManager for recent main changes 2022-11-15 17:05:30 +00:00
jesopo
93a1b7476f remove ability for user to specify custom management room 2022-11-15 17:05:30 +00:00
jesopo
4a9e5d422d resolve typing errors, run api when appservice runs 2022-11-15 17:05:30 +00:00
jesopo
be18613722 fix some linting, move all Intent related code to AppService.ts 2022-11-15 17:05:30 +00:00
jesopo
6d604190a4 add managementRoomId to provisionNewMjolnir 2022-11-15 17:05:30 +00:00
jesopo
c1d79a698b draft widget backend 2022-11-15 17:05:30 +00:00
gnuxie
b943a02cda update deps 2022-11-15 17:05:30 +00:00
gnuxie
f68b511256 move appservice bits 2022-11-15 17:05:30 +00:00
gnuxie
94040b00d6 AppService start 2022-11-15 17:05:30 +00:00
David Teller
81cd91c250
Unbitrotting ruleserver tests (#418) 2022-11-15 13:06:41 +01:00
Gnuxie
fb52e3dcb2
Improve the clarity of the unban command (#402)
Also fix a years long bug where the Flooding/Media protection wouldn't stop redacting users

Closes #393
Closes #394

* Warn about room level bans when using unban

https://github.com/matrix-org/mjolnir/issues/394

* Clear internal queues within protections when unban happens.

https://github.com/matrix-org/mjolnir/issues/393
2022-11-07 11:28:59 +00:00
Gnuxie
2c00ac4372
Always echo policy list changes (#401)
closes https://github.com/matrix-org/mjolnir/issues/392.
2022-11-07 11:27:54 +00:00
gnuxie
a970733d0b Update roomMemberTest for removal of mjolnir.protectedRooms object.
https://github.com/matrix-org/mjolnir/issues/370.
2022-10-19 15:21:51 +01:00
gnuxie
cfea765493 Fix list rooms command improperly iterating protected rooms. 2022-10-19 15:21:51 +01:00
gnuxie
c7ba745081 Stop ProtectedRoomsSet verifying permissions for unprotected rooms. 2022-10-19 15:21:51 +01:00
gnuxie
c537f2067e protected rooms config test
https://github.com/matrix-org/mjolnir/issues/370
2022-10-19 15:21:51 +01:00
gnuxie
cea6944c92 Status command can distinguish between protected and watched lists.
https://github.com/matrix-org/mjolnir/issues/370
2022-10-19 15:21:51 +01:00
gnuxie
5c2e4ab0bb Change list creation command to also protect the new room
https://github.com/matrix-org/mjolnir/issues/370
2022-10-19 15:21:51 +01:00
gnuxie
97673cdccb Make Mjolnir use ProtectedRoomsConfig
https://github.com/matrix-org/mjolnir/issues/370
2022-10-19 15:21:51 +01:00
gnuxie
58e36d4e23 Factor out protected rooms config management from Mjolnir.
The combination of `resyncJoinedRooms`, `unprotectedWatchedListRooms`,
`explicitlyProtectedRoomIds`, `protectedJoinedRoomIds` was incomprehensible.
https://github.com/matrix-org/mjolnir/issues/370

Separating out the management of `explicitlyProtectedRoomIds`, then
making sure all policy lists have to be explicitly protected
(in either setting of `config.protectAllJoinedRooms`) will make
this code much much simpler.
We will later change the `status` command to explicitly show
which lists are watched and which are watched and protected.
2022-10-19 15:21:51 +01:00
Gnuxie
da084328a9
Refactor list creation with MSC3784 support. (#386)
https://github.com/matrix-org/matrix-spec-proposals/pull/3784

This was extracted from the appservice mjolnir work to reduce review burden.
2022-10-19 10:33:12 +01:00
Gnuxie
5bd23ced9b
Access Control Unit (#378)
The ACL unit allows you to combine an policy lists and conveniently test users and servers against them.
The main motivation for this work is provide access control on who can provision and continue to use mjolnir instances in the appservice component.
We include a new recommendation type org.matrix.mjolnir.allow which can be used with user and server entity types to create allow lists.
We have also replaced the destructing of policy lists in applyServerACL and applyMemberBans (in ProtectedRooms.ts) with calls to the AccessControlUnit.
Adding commands to add/remove allowed entities is not something i want to do at the moment.
2022-10-18 16:28:11 +01:00
David Teller
7b0edadd17
Update tests and instructions to intercept reports also with v3 endpoint (#388)
In both our instructions and our tests, we use the r0 endpoint to intercept abuse reports. This endpoint is deprecated and not implemented by all clients. This PR updates the instructions and tests to the new endpoint.
2022-10-18 15:48:39 +02:00
mahdi1234
938b9fea8f
Fixed typo (#389) 2022-10-18 13:45:57 +01:00
David Teller
28265cec2e
CI: Let's try and cache mx-tester installs (#383) 2022-10-10 17:17:22 +02:00
Than Harrison
0379cc45fb
Fix small typo (#382)
* src/commands/CommandHandler.ts:
 - fix small typo that's bugging me in `!status` response.
   change "projection" -> "protection"

Signed-off-by: Than Harrison <infosecvoid@proton.me>

Signed-off-by: Than Harrison <infosecvoid@proton.me>
2022-10-10 12:35:35 +02:00
Gnuxie
77ad40e27a
Refactor protected rooms. (#371)
* Attempt to factor out protected rooms from Mjolnir.

This is useful to the appservice because it means we don't
have to wrap a Mjolnir that is designed to sync.

It's also useful if we later on want to have specific
settings per space.

It's also just a nice seperation between Mjolnir's needs while
syncing via client-server and the behaviour of syncing policy rooms.

 ### Things that have changed

- `ErrorCache` no longer a static class (phew), gets used by `ProtectedRooms`.
- `ManagementRoomOutput` class gets created to handle logging back to the management room.
- Responsibilities for syncing member bans and server ACL are handled by `ProtectedRooms`.
- Responsibilities for watched lists should be moved to `ProtectedRooms` if they haven't been.
- `EventRedactionQueue` is moved to `ProtectedRooms` since this needs to happen after
  member bans.
- ApplyServerAcls moved to `ProtectedRooms`
- ApplyMemberBans move to `ProtectedRooms`
- `logMessage` and `replaceRoomIdsWithPills` moved to `ManagementRoomOutput`.
- `resyncJoinedRooms` has been made a little more clear, though I am concerned about how often it does run because it does seem expensive.


* ProtectedRooms is not supposed to track joined rooms.

The reason is because it is supposed to represent a specific
set of rooms to protect, not do horrible logic
for working out what rooms mjolnir is supposed to protect.
2022-09-29 14:49:09 +01:00
Jess Porter
f108935d07
support compound consequences, switch WordList to consequences (#351) 2022-09-26 16:57:21 +01:00
Denis Lisov
89b7ec1a18
Add list shortcodes to status command output (#312) 2022-09-14 10:32:14 +01:00