gnuxie
743f6d043a
Fix filter when paginating history in getMessagesByUser.
...
Related to https://github.com/matrix-org/mjolnir/pull/132 .
The old code would call `/sync` with this filter. If a token was
provided in the response of `/sync` for earlier messages, it would
then use this same filter to call `/rooms/messages`. However, this
filter does not do anything on that endpoint when we know the id of
the sender, as it requires a RoomEventFilter and there is no warning
or error from synapse about the structure of the filter being wrong.
This was not noticed until after the related PR because `/sync` with
the filter would usually be able to provide a user's
entire history in one room. This is because in most cases a user is banned/redacted
shortly after joining a room.
In the case that `/rooms/messages` was called for more events, the method would
always paginate the timeline up until the limit or the end of the room
history, which is only the expected behavior when matching the sender
with a "glob".
2021-10-19 16:28:55 +01:00
David Teller
06e5f00b2d
Intercept /report and display human-readable abuse reports in the moderation room - Resolves #38 ( #135 )
...
* Intercept /report and display human-readable abuse reports in the moderation room - Resolves #38
2021-10-07 14:42:08 +02:00
gnuxie
776c1fe063
Tidy logging in integration tests
2021-09-30 15:52:06 +01:00
gnuxie
400af48e6e
Move Mjolnir setup and configuration to a sensible place.
2021-09-27 16:04:01 +01:00
gnuxie
0a6b122f5c
Tidy up documentation and test utils
2021-09-27 15:33:15 +01:00
gnuxie
68aa717826
Rework integration tests to work with mx-tester
2021-09-24 18:25:27 +01:00
gnuxie
1d2da60bee
Allow relative paths for mjolnir data
...
These are relative to the project directory.
2021-09-24 18:25:27 +01:00
gnuxie
57ef8ab7fe
Tidy up test harness.
2021-09-24 18:25:27 +01:00
Gnuxie
002e4ee749
Create docker-compose for testing purposes
2021-09-24 18:25:27 +01:00
Chirayu Desai
69ace9cfa5
Add a new protection, MessageIsMedia
...
* Simply redacts any media sent to the room, by anyone
* Meant to serve as a temporary measure to prevent image spam,
in conjunction with FirstMessageIsImage
2021-09-24 16:57:16 +05:30
gnuxie
6edf503a9c
Use rooms/initialSync
instead of sync
to fetch room history.
...
See https://github.com/matrix-org/synapse/issues/10842 .
For the time being this seems to be the only way to avoid requests
that take several minutes for synapse to complete and timeout.
2021-09-17 12:02:14 +01:00
gnuxie
5acc38c8b5
EventRedactionQueue documentation improvements from review
2021-09-16 17:10:59 +01:00
gnuxie
ad199cc7d7
Use a Map for queueing redactions by roomId.
2021-09-15 12:18:55 +01:00
gnuxie
2889599eb2
Rename AutomaticRedactionQueue to UnlistedUserRedactionQueue.
...
This seems to be a more descriptive name and it also doesn't clash
with the new redaction queue.
2021-09-14 14:45:07 +01:00
gnuxie
c949d26582
When checking a member change, process redactions for that room.
2021-09-14 14:45:07 +01:00
gnuxie
c5b5026d4d
WIP: Redact events after all bans have been applied.
2021-09-14 14:13:24 +01:00
David Teller
e45791f66e
Merge pull request #102 from jojosch/catch-errors
...
catch errors and set non-zero exit code
2021-08-31 11:52:47 +02:00
Travis Ralston
37031764ac
Merge pull request #117 from matrix-org/yoric/delete-rooms-api
...
Replace shutdown_room API with DELETE /_synapse/admin/v1/rooms/<room_…
2021-08-17 09:23:55 -06:00
David Teller
dd6c06eae5
Fix: Let's default to Synapse's default message when deleting a room without a message
2021-08-17 17:21:17 +02:00
Travis Ralston
f09fd5d507
Merge pull request #123 from matrix-org/travis/voice-prot
...
Add a voice message protection to easily redact unwanted messages
2021-08-17 08:46:34 -06:00
David Teller
b60f503e2e
FIXUP
2021-08-17 12:56:25 +02:00
David Teller
62b30b19d9
Replace shutdown_room API with DELETE /_synapse/admin/v1/rooms/<room_id> - Resolves #76 , closes #96
...
As per https://github.com/matrix-org/synapse/issues/9052 , shutdown_room is going away, to be replaced with DELETE /_synapse/admin/v1/rooms/<room_id>.
2021-08-17 12:54:24 +02:00
Travis Ralston
4c6511ba3d
Definitely didn't copy/paste
2021-08-16 20:35:39 -06:00
Travis Ralston
453784d7ef
Add a voice message protection to easily redact unwanted messages
2021-08-16 20:32:00 -06:00
David Teller
46d099e8e0
Lint: Enabling 'noUnusedLocals'
2021-07-22 08:47:41 +02:00
David Teller
2e22154870
Lint: Enabling 'strictNullChecks'
2021-07-22 08:40:29 +02:00
David Teller
2a77509f9e
Lint: Enabling 'noImplicitReturns'
2021-07-22 08:24:12 +02:00
Travis Ralston
ff4cbc018f
Update matrix-bot-sdk and use request cleaning function
2021-07-01 15:11:27 -06:00
Johannes Schleifenbaum
662b06df8e
catch errors and set non-zero exit code
...
Signed-off-by: Johannes Schleifenbaum <johannes@js-webcoding.de>
2021-06-14 19:03:35 +02:00
Neil Middleton
1c5c4bdc15
Remove errant log
2021-06-14 14:51:18 +01:00
Neil Middleton
531fd1379c
Make !mjolnir
not case sensitive
2021-06-14 14:43:50 +01:00
J. Ryan Stinnett
259cdd8c12
Improve force handling
...
This improves the force argument parsing to keep it from getting glued onto the
reason. It also adjusts tests for the new behaviour.
2021-02-05 17:03:36 +00:00
J. Ryan Stinnett
46192ac6f7
Add confirmation for wildcard bans
...
This adds a default enabled option to require confirmation for wildcard bans
(e.g. those containing `*` or `?`). Users will need to also add `--force` for
the commands to be accepted.
2021-02-05 16:09:11 +00:00
Emi Tatsuo
50f2352001
Refactored to more verbose variable names; Updated copyright
2020-10-31 09:28:50 -04:00
Emi Tatsuo
4c0bbd845d
Removed default words from word list in favor of more neutral words
2020-10-31 09:23:18 -04:00
Emi Tatsuo
6fa93e3bae
Corrected description of WordList to be time-independant
2020-06-21 16:26:51 -04:00
Emi Simpson
1e47be497b
Fix lint
...
Signed-off-by: Emi Simpson <emi@alchemi.dev>
2020-06-21 15:21:50 -04:00
Emi Simpson
c2fbf0934a
Added configuration for wordlist protection
2020-06-21 15:18:34 -04:00
Emi Simpson
bccb18225b
Added unconfigurable wordlist protection
2020-06-21 13:56:11 -04:00
Travis Ralston
635f9ba03f
Prioritize bans over redactions, and queue redactions faster
...
This could do with some cleanup, particularly around the part where it uses a callback.
2020-06-12 08:15:48 -06:00
Travis Ralston
4751b093a5
Add Healthz support
2020-06-12 08:03:08 -06:00
Travis Ralston
7ee66a03dd
Trim command arguments too for accessory spaces
2020-05-11 21:36:53 -06:00
Travis Ralston
7cb34f99b9
Appease the linter
2020-05-11 21:36:05 -06:00
Travis Ralston
013cac1365
Fix remaining getRoomAlias calls
2020-05-11 21:35:37 -06:00
Travis Ralston
45a8f2899b
Fully remove ban list server support
2020-05-11 21:33:28 -06:00
Travis Ralston
46bc6a1a0f
Bump bot-sdk version to handle published aliases better
2020-05-11 21:31:47 -06:00
Travis Ralston
9e18a6dfff
Add additional safety around room alias resolution for pills
...
Just fall back to not caring if we have to.
2020-05-11 21:30:22 -06:00
Travis Ralston
7fa025f678
Remove ban list server support
...
This will take the shape of something else eventually.
2020-05-11 21:11:24 -06:00
Travis Ralston
cdc8170a8f
Fix assumption that an error message will be present
2020-05-05 18:36:24 -06:00
Travis Ralston
7f185eced3
Appease the linter
2020-04-15 09:22:03 -06:00
Travis Ralston
6195acb092
Appease the linter
2020-04-15 09:21:23 -06:00
Travis Ralston
6dd59120a7
Revert "Disable ban list server for release"
...
This reverts commit 1a8edd54f7
.
2020-04-15 08:14:24 -06:00
Travis Ralston
1a8edd54f7
Disable ban list server for release
2020-04-15 08:13:57 -06:00
Travis Ralston
232a6e2bb9
Use room aliases in permission errors too
2020-04-15 08:12:42 -06:00
Travis Ralston
a8d03ffea7
Add a kick command
2020-04-15 08:12:42 -06:00
Travis Ralston
f6a856ed4a
Resolve room aliases in messages
...
Fixes https://github.com/matrix-org/mjolnir/issues/47
2020-04-15 08:12:42 -06:00
Travis Ralston
6f80a17558
Improve redaction handling
2020-04-14 16:49:20 -06:00
Travis Ralston
06398967c5
Revert "Disable ban list server for release"
...
This reverts commit ea6c9bd7df
.
2020-03-05 15:42:45 -07:00
Travis Ralston
ea6c9bd7df
Disable ban list server for release
2020-03-05 15:39:34 -07:00
Travis Ralston
ecc7674422
Add optional reporting of invites that won't be accepted
2020-03-05 15:38:09 -07:00
Travis Ralston
7314df7379
Re-work invite settings to better support practical use cases
2020-03-05 15:29:30 -07:00
Travis Ralston
f5763803d9
Add a command to resolve a room alias to a room ID
2020-02-21 09:58:22 -07:00
Travis Ralston
3dd4274b3b
Add alias add/remove commands
...
Fixes https://github.com/matrix-org/mjolnir/issues/42
2020-02-20 13:30:48 -07:00
Travis Ralston
39903ee298
Don't explode if we fail to leave protected rooms when de-protecting
2020-02-19 15:52:41 -07:00
Travis Ralston
ba7ea90fcb
Don't cause panic if the bot can't protect a ban list it didn't create
...
This only affects users with `protectAllJoinedRooms` enabled, as the bot can't possibly protect ban lists it did not create itself.
2020-02-18 17:06:27 -07:00
Travis Ralston
697ada6592
Make the bot less concerned about the format of commands
...
Fixes https://github.com/matrix-org/mjolnir/issues/39
2020-02-18 13:46:31 -07:00
Travis Ralston
e424f03ef2
Support redacting an individual event
2020-02-16 14:00:40 -07:00
Travis Ralston
1a591b4dcf
Revert "Disable ban list server for release"
...
This reverts commit 3e303219a6
.
2020-02-13 23:06:12 -07:00
Travis Ralston
3e303219a6
Disable ban list server for release
2020-02-13 23:04:57 -07:00
Travis Ralston
dea6f8cbf1
Add a command to shut down a room
...
Fixes https://github.com/matrix-org/mjolnir/issues/21
2020-02-13 13:56:03 -07:00
Travis Ralston
8465a1ed78
Specify a default ban reason
...
Fixes https://github.com/matrix-org/mjolnir/issues/20
2020-02-13 13:50:17 -07:00
Travis Ralston
90cc3d01b4
Add text next to protections emoji
...
Fixes https://github.com/matrix-org/mjolnir/issues/16
2020-02-13 13:48:10 -07:00
Travis Ralston
8e5f8c19af
Move ban message to INFO
...
Fixes https://github.com/matrix-org/mjolnir/issues/19
2020-02-13 13:46:09 -07:00
Travis Ralston
5b4c253002
Add a 'set powerlevel' command
...
Fixes https://github.com/matrix-org/mjolnir/issues/35
2020-02-13 13:43:30 -07:00
Travis Ralston
aee562455a
Add commands for managing room aliases and the room directory
2020-02-13 12:40:44 -07:00
Travis Ralston
223464227b
Move power level change notices to DEBUG
...
Fixes https://github.com/matrix-org/mjolnir/issues/32
2020-02-12 15:42:10 -07:00
Travis Ralston
f7448564be
Load a default config when a default can't be located
...
The config package will use default.yaml for us, but most deployments won't have set that up correctly so instead we offer sensible defaults in addition to the thing from config.
2020-02-12 15:38:52 -07:00
Travis Ralston
9e5c87ac56
Add options to specify custom command prefixes
...
Fixes https://github.com/matrix-org/mjolnir/issues/29
2020-02-12 15:27:27 -07:00
Randshot
bef99297f9
Remove scary text...
...
Signed-off-by: Randshot <randshot@norealm.xyz>
2020-02-03 17:37:27 +01:00
Randshot
03382ce70c
Fix unban command
...
Signed-off-by: Randshot <randshot@norealm.xyz>
2020-02-01 10:30:23 +01:00
Travis Ralston
fa6a6547ee
Add very basic subscription server for Synapse module
2020-01-25 20:34:15 -07:00
Travis Ralston
7a015a9f06
Appease the linter
2020-01-21 15:25:17 -07:00
Travis Ralston
c0365416fa
Add an option to protect all joined rooms
2020-01-21 15:19:03 -07:00
Travis Ralston
97d02b3816
Add an option to only autojoin invites from bot managers
2020-01-21 13:53:02 -07:00
Travis Ralston
38e22ee155
Add commands to add/remove protected rooms on the fly
2020-01-21 13:46:15 -07:00
Travis Ralston
c1ea98f55d
Fix logging for status command
2020-01-21 13:17:38 -07:00
Travis Ralston
959162c4a3
Support automatically redacting users for certain ban reasons
2019-12-09 19:56:12 -07:00
Travis Ralston
6753e7f780
Allow the redact command to take globs
2019-12-09 19:43:41 -07:00
Travis Ralston
7de3744875
Respect no-op in more places
2019-12-09 19:20:47 -07:00
Travis Ralston
f9e3c33935
Don't spam protection warnings, and ensure the user is redacted
...
We now always prioritize redaction over ban to ensure that the user gets removed from our rooms. This also means that the second image posted by a spammer is redacted after join.
This commit also improves the messaging a bit.
2019-12-09 19:15:51 -07:00
Travis Ralston
245b81262e
Fix linter
2019-12-04 19:28:49 -07:00
Travis Ralston
fd2343dd28
Add some null safety to ban lists
2019-12-04 19:28:31 -07:00
Travis Ralston
0879cd58a0
Actually fix ban command not always applying
...
Fixes https://github.com/matrix-org/mjolnir/issues/13
2019-12-04 19:28:28 -07:00
Travis Ralston
3be2da5c47
Automatically sync the ban lists after issuing a ban
...
Workaround for https://github.com/matrix-org/mjolnir/issues/13 .
Fixes https://github.com/matrix-org/mjolnir/issues/13
2019-12-04 19:28:24 -07:00
Travis Ralston
1b795c7b17
Add basic flooding protection too
2019-12-04 19:07:04 -07:00
Travis Ralston
d5f260b982
Add a protection system with a "first message is an image" demo
2019-12-04 18:51:03 -07:00
Travis Ralston
4f8b55c45f
Update matrix-bot-sdk
2019-12-04 18:46:00 -07:00
Travis Ralston
07c9c04169
Detect UISI errors from pantalaimon in the management room
2019-11-14 15:59:01 -07:00
Travis Ralston
778f9c3459
Add a command to deactivate a user
2019-11-14 15:44:13 -07:00
Travis Ralston
417673aeef
Test for ban reasons as well in autodetection
2019-11-13 21:46:20 -07:00
Travis Ralston
66a5775136
Make the [un]ban command smarter
...
Fixes https://github.com/matrix-org/mjolnir/issues/11
2019-11-13 21:38:19 -07:00
Travis Ralston
dd260091bb
Add a command to set a default ban list
2019-11-13 20:34:45 -07:00
Travis Ralston
40113a0760
Use the correct reference to Mjolnir's client
2019-11-11 14:31:25 -07:00
Travis Ralston
6018cd3ed3
Add more startup logging
2019-11-07 11:06:56 -07:00
Travis Ralston
b1fd36737f
Make the startup check less aggressive for joins
2019-11-07 11:05:52 -07:00
Travis Ralston
9f84a65598
Don't apply bans globally when membership changes
2019-11-07 11:00:41 -07:00
Travis Ralston
82214c6cd8
Avoid spamming the management room with errors
...
The intervals are arbitrarily defined.
Fixes https://github.com/matrix-org/mjolnir/issues/10
2019-11-06 19:17:11 -07:00
Travis Ralston
30e186ca9c
Add a config option to reduce homeserver load during ban checks
2019-11-06 18:54:59 -07:00
Travis Ralston
84135c5ff5
Update log handling for debugging
2019-11-06 18:46:49 -07:00
Travis Ralston
0575c56b74
Add a config flag to reduce logging noise
2019-10-31 09:55:34 -06:00
Travis Ralston
eccbac9ccf
Check if ACLs match before applying them
...
Fixes https://github.com/matrix-org/mjolnir/issues/9
2019-10-30 14:49:59 -06:00
Travis Ralston
12a3d6255d
Add a moderator's guide to Mjolnir
...
Fixes https://github.com/matrix-org/mjolnir/issues/6
2019-10-28 20:20:47 -06:00
Travis Ralston
354caa96c0
Appease the linter
2019-10-23 13:25:32 -06:00
Travis Ralston
bb6d457f98
Fix timeline filter
2019-10-18 16:38:27 +01:00
Travis Ralston
5cd89d5c4e
Fix handling of state events
2019-10-18 16:38:19 +01:00
Travis Ralston
2ea3bdccb3
Fix messaging for bans
2019-10-18 16:38:07 +01:00
Travis Ralston
5409f4916a
Add a way to actually unban people
2019-10-10 12:37:42 +01:00
Travis Ralston
8fbd918431
Add a rule import command
2019-10-10 11:30:52 +01:00
Travis Ralston
78b73153b7
Add a redact command
2019-10-09 15:53:37 +01:00
Travis Ralston
28f739a3a2
Ignore events sent by Mjolnir itself
2019-10-09 15:00:56 +01:00
Travis Ralston
adec9f58a6
Add a no-op mode
2019-10-09 14:51:30 +01:00
Travis Ralston
7501e3123a
Don't double report success for !mjolnir sync
2019-10-09 14:46:14 +01:00
Travis Ralston
cb20aefea3
Appease the linter
2019-10-09 11:29:01 +01:00
Travis Ralston
49468c5aab
Fix command processing for recent refactorings
2019-10-08 21:06:54 +01:00
Travis Ralston
05ab8f60c6
Add watch and unwatch commands
2019-10-08 20:58:31 +01:00
Travis Ralston
1f449a9fc1
Move list watching into Mjolnir class
2019-10-08 18:25:57 +01:00
Travis Ralston
9056634124
Don't mention updates for rooms we don't protect
2019-10-08 17:58:37 +01:00
Travis Ralston
aecc6e4882
Support multiple ban lists
2019-10-08 17:57:03 +01:00
Travis Ralston
49fd0ca3f6
Consider startup logging as verbose
2019-10-04 21:38:50 -06:00
Travis Ralston
d4171a36a2
Check permissions when power levels change in protected rooms
2019-10-04 21:36:19 -06:00
Travis Ralston
83e74af525
Add a command to perform permission checks
2019-10-04 21:26:38 -06:00
Travis Ralston
7bd23a17d9
Optionally perform permission checks on startup
2019-10-04 21:22:51 -06:00
Travis Ralston
383985c732
Correctly represent state in !mjolnir command
2019-10-04 21:22:18 -06:00
Travis Ralston
5e081e2246
Add an option to sync rooms on startup
2019-10-04 21:02:37 -06:00
Travis Ralston
e69f0e6940
Improve/change logging to management room
2019-10-04 20:59:30 -06:00
Travis Ralston
517025b6c2
Support Pantalaimon for encryption support
...
Requires a special build of the bot-sdk and pantalaimon currently
2019-10-02 22:20:37 -06:00
Travis Ralston
82ae8d7062
Rewrite ping-based commands to avoid space parsing problems
2019-09-27 20:07:16 -06:00
Travis Ralston
063bac77e5
Add a sync command
2019-09-27 20:02:03 -06:00
Travis Ralston
834abc97dd
Apply user bans
2019-09-27 19:54:36 -06:00
Travis Ralston
149cbcfbd2
Remove unused function from ban lists
2019-09-27 19:54:07 -06:00
Travis Ralston
f1f7424de9
Fix rules list not being closed
2019-09-27 19:53:24 -06:00
Travis Ralston
149d6dfa2e
Add a help command
2019-09-27 16:12:53 -06:00
Travis Ralston
4d16ff3e51
Actually reply to status commands
2019-09-27 16:05:55 -06:00
Travis Ralston
02288a3885
Respond to pings too
2019-09-27 16:04:08 -06:00
Travis Ralston
fa1ad260f1
Add a command to dump the rules the bot is using
2019-09-27 15:57:39 -06:00
Travis Ralston
39b59dbee1
Add commands for managing a personal ban list
2019-09-27 15:44:28 -06:00
Travis Ralston
41cc36e4c6
Refactor bot into its own class
2019-09-27 15:15:10 -06:00
Travis Ralston
3a567edc38
Add a config option to pick the protected rooms
2019-09-27 14:36:23 -06:00
Travis Ralston
d32ad18f3a
Update server ACLs when they change
2019-09-27 14:26:57 -06:00
Travis Ralston
23c6c20768
Early ban list processing (parsing, specifically)
2019-09-27 13:57:36 -06:00