Commit Graph

370 Commits

Author SHA1 Message Date
gnuxie
69f4b39a8c Rename and remove typos from makeADminCommandTests.ts 2022-05-03 12:33:09 +01:00
gnuxie
61192daff5 Tidy makeAdminCommandTest.ts
This was pretty suspect with the number of clients syncing  unnecessarily, it was
also really hard to read. It also tests the same thing twice, even if it is
a slightly different way.

https://github.com/matrix-org/mjolnir/pull/219/files#diff-4e8bbc9dde21b7b895e0c081d2e3375c8958c51a10442497dfffb677f0d59a1aR1-R107
2022-05-03 12:33:05 +01:00
Jonathan de Jong
cc9f393ed7
fix CI (#282)
ts-mocha has also been updated to make running locally possible (else it gives a confusing error that tsconfig.json is not "json" or the likes)
2022-05-03 11:20:40 +01:00
Gnuxie
3d10f998b7
Change antispam Python module verison with mjolnir version. (#264)
The reason we want this is so that people do not forget to change the version number in the synapse module.
The precedent is that the version number has been 0.1.0 since the begging until now.
While this solution does mean that there may be new version of the module where
nothing has actually changed, this is still better than not changing the version at all.
Another version scheme for the module would be inconsistent to
the git repository tags and that has the potential to cause much more confusion
than "blank" version bumps.
If this is a problem, then antispam must be extracted to another repository.

In order to test this, run `yarn version --patch` observe the changes with `git log` and `git diff HEAD~`,
then YOU MUST delete the tag with `git tag --delete vd.d.d` when you are finished.

* more robust
2022-04-12 16:36:35 +01:00
Gnuxie
b8ee2fddbf
Synapse requires registration to be explicit (#275) 2022-04-12 12:56:27 +01:00
Marco Cirillo
4f070244ce
Amend README.md for antispam config example. (#271) 2022-04-06 18:20:49 +02:00
Gnuxie
f63edbefa0
Make startup failures more controlled and understandable. (#270)
There is no reason to call process.exit() from `index.ts` or in `Mjolnir.start()` because

https://nodejs.org/api/process.html#warning-using-uncaughtexception-correctly

>The 'uncaughtException' event is emitted when an uncaught JavaScript exception bubbles all the way back to the event loop. By default, Node.js handles such exceptions by printing the stack trace to stderr and exiting with code 1, overriding any previously set process.exitCode. Adding a handler for the 'uncaughtException' event overrides this default behaviour.
2022-04-01 16:40:10 +01:00
Gnuxie
fb7167773b
Use github workflows to push dockerhub images+tags. (#265) 2022-03-28 15:25:31 +01:00
dependabot[bot]
31ef9065da
Bump minimist from 1.2.5 to 1.2.6 (#260)
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-25 10:05:23 +00:00
gnuxie
4008e3f65d v1.4.1 2022-03-21 14:28:21 +00:00
jesopo
fccb4627ce show room ID in consequence log 2022-03-21 14:25:12 +00:00
jesopo
afd003b905 remove line leftover from debugging 2022-03-21 14:11:45 +00:00
gnuxie
fb027fe2af v1.4.0 2022-03-21 12:32:32 +00:00
David Robertson
95d394b964
Merge pull request #246 from matrix-org/dmr/fix-check-username-as-spam
Fix block_usernames config option
2022-03-21 11:54:12 +00:00
David Teller
e05616b327
New command !mjolnir since <date or duration> <kick | ban | show> <limit> [reason] [...rooms] (#238)
A new command `since` to affect all users who have joined a protected room since a given date.
2022-03-21 10:39:15 +01:00
Gnuxie
814e528eaf
Fix incorrect type deceleration in check_username_for_spam (#250)
Fixes https://github.com/matrix-org/mjolnir/issues/245
2022-03-18 17:20:53 +00:00
Gnuxie
48206a8524
Move message_limit into antispam. (#243)
* Move message_limit into antispam.

https://github.com/matrix-org/message_limit

Not ideal but we've had complaints about keeping them separate
and unfortunately the need for this module is not going to go away.
2022-03-18 11:07:21 +00:00
Jess Porter
1880287ac4
standard protection consequences (#232)
* standard protection consequences

* add integration test to make sure good users aren't banned

* the less far `event` propagates, the better

* better document consequence.ts

* improve innocent user integration test

* switch to room.event emit
2022-03-18 10:11:23 +00:00
David Robertson
2c9fc0ccdc
Fix block_usernames config option
Fixes #244.
2022-03-17 16:53:31 +00:00
David Teller
26ae55cd24
A command to show when users in a given room have joined (#225) 2022-03-07 11:34:25 +01:00
Marco Cirillo
97df4d5f61
Add command to elevate a user (or the bot) as room administrator (#219) 2022-03-07 10:14:06 +01:00
jesopo
65af82d46f send whole channel shutdown reason, not just the first word 2022-03-02 10:20:43 +00:00
David Teller
eb7f5f6b3e
Reduce stackspam (#237)
This should cut a lot on the noise in logs.
2022-02-25 17:59:34 +01:00
Gnuxie
17dd0aa173
Fix the test script yarn test:manual and add it to tsconfig (#234)
* Add test:manual launch script to tsconfig

this is so we won't keep breaking it
2022-02-24 14:46:15 +00:00
Gnuxie
7353ba4919
Make limit for ACL batcher more leniant for CI (#235) 2022-02-24 14:27:53 +00:00
David Teller
82a2e63d23
A room Protection designed to measure lag in a room (#217) 2022-02-24 13:43:31 +01:00
gnuxie
a3f77e1b39 v1.3.2 2022-02-23 10:38:42 +00:00
Gnuxie
332da15d0d
Remove old rules when unbanning entities from BanLists. (#227)
* Remove old rules when unbanning entities from BanLists.

Fixes #220
2022-02-21 16:51:14 +00:00
Jess Porter
a58c7d3f1a
move LogProxy.logMessage to Mjolnir.logMessage (#194) 2022-02-15 15:44:41 +00:00
Gnuxie
e9dff8fd5a
Batch events from ban lists together during sync (#221)
* Test for batching ACL.

* Batch events from sync within BanList.

* Introduce the BanList.batch event to the BanList emitter to let Mjolnir sync after new events have been added from sync.

Fixes #203
2022-02-15 13:51:20 +00:00
Marco Cirillo
097829d75a
Set missing CORS headers for Report API responses. (#222) 2022-02-15 09:19:13 +01:00
reivilibre
e49e4d05eb
Use public imports for UserID and run_as_background_process (#175) 2022-02-11 10:13:16 +01:00
David Teller
6cb461fed4
Move glob_to_regex into the source - resolves #173 (#218) 2022-02-09 13:07:23 +01:00
David Teller
9c9bd0e029
Let's port to Synapse module API (#128) 2022-02-09 08:40:33 +01:00
Jess Porter
f74cf8a6e5
trusted reporters (#183)
* Trusted Reporters protection

* redact/ban reasons

* some documentation
2022-02-08 13:07:42 +00:00
Gnuxie
ff9a7db159
Make ACL safe so that Mjolnir will not ban itself. (#213) 2022-02-07 17:02:06 +00:00
jesopo
813741c42c refactor (and simplify) how protections are stored in-memory 2022-02-07 13:48:32 +00:00
jesopo
8b23f93b71 splice returns removed items, not a new list with items removed 2022-02-07 13:33:44 +00:00
Graham Christensen
d364d9879a
default.yaml: expand on fasterMembershipChecks (#163)
It isn't clear what it means to have the server "struggle" with state requests.

This change is trying to make the configuration more actionable to end users.
2022-02-07 12:41:26 +00:00
Marco Cirillo
eb8c5e08b4 Update legacy antispam plugin with newer types.
Or it'll just ignore 1.3.1 rules.
2022-02-07 10:57:38 +01:00
Jess Porter
58e228be7d
make roomIds param on replaceRoomIdsWithPills a Set<string> (#146) 2022-02-02 17:35:02 +00:00
Jess Porter
f70d97e4d9
enable noImplicitAny (#209) 2022-02-02 12:43:05 +00:00
gnuxie
fcf53d15b8 v1.3.1 2022-02-01 13:21:04 +00:00
Gnuxie
8a9ded80c1
do not require rule server config to be present. (#208) 2022-02-01 13:20:26 +00:00
gnuxie
767e1a5a7e v1.3.0 2022-02-01 10:55:21 +00:00
Gnuxie
e52b59df6e
Fix bad teardowns that hang in tests. (#202)
* Fix bad teardowns and hanging test.
2022-01-28 11:03:20 +00:00
Gnuxie
0cde70e846
Merge pull request #199 from matrix-org/gnuxie/remove-axios
Remove axios (from tests)
2022-01-27 09:25:32 +00:00
gnuxie
f481ec84d3 Make sure we stop clients after they have started, not before.
Yeah it's a long story.
2022-01-26 16:25:43 +00:00
gnuxie
17a1d02af8 Fix uses of old interface for registration helper in tests. 2022-01-25 18:23:14 +00:00
gnuxie
9e96d399c0 Remove axios from the test suite, it is unnecessary.
It's probably also got problems.
2022-01-25 18:22:34 +00:00