Commit Graph

1220 Commits

Author SHA1 Message Date
gnuxie
feb452e474 Figure out how to seperate some logs into their own rooms.
We still need to figure out whether we want to disable the room
discovery or enable it by default.
2025-05-26 23:14:29 +01:00
gnuxie
6649000552 Update all protection descriptions to use an async factory. 2025-05-26 19:13:08 +01:00
Gnuxie
120111f075 Merge pull request #871 from the-draupnir-project/gnuxie/takedown-improvements
- disable room discovery by default while we work out how to pipe it into a new room
- show status of takedown protections in the takedown command
- clarify a comment about the implementation of blocking invintations

We really need to figure out how to let protections put all their output into a room.
2025-05-25 19:58:25 +01:00
gnuxie
2a731bf66b Clarify a comment about the implementation of blocking invitations. 2025-05-23 18:08:47 +01:00
gnuxie
dd3a50125d Show status of takedown protections in the takedown command.
This is in order to reinforce their use
Fixes https://github.com/the-draupnir-project/Draupnir/issues/862.
2025-05-23 18:03:23 +01:00
gnuxie
2ab9e37aa3 Disable room discovery by default.
It is too noisy and i don't think people have time to review it.  In a
moment i will try see if i can create a new room for the protection at
startup in a moment.
2025-05-23 16:53:08 +01:00
Catalan Lover
ce926ed18f YEEET synapse_antispam (#866) 2025-05-23 01:24:21 +02:00
Gnuxie
39e4522c74 Improve room shutdown flows. (#858)
* Improve room shutdown flows.

- The shutdown command now has a `--notify` option for whether to send
  the violation notification.
- We use shutdown V1 because V2 doesn't propagate leave events to clients
  properly. Which sucks.

* Fix flakey shutdown test.

So this was never working it was just catching the original message
containing the command by speed of shutdown V2.
2025-05-20 18:25:08 +01:00
Gnuxie
5ad37c9b3c Update to MPS 3.1.2 for better ACL handling. (#856)
* Update to MPS 3.1.2 to help with ACL.

* Update ServerACLConsequencesRenderer for MPS update.
2025-05-20 15:17:36 +01:00
Gnuxie
8ccbe86d19 Add a command that can remove specific policies without other effects. (#853)
Can't find the issue but it exists.
2025-05-19 11:55:25 +01:00
Kim Brose
97e9c815f6 Typo (#854)
Signed-off-by: HarHarLinks <2803622+HarHarLinks@users.noreply.github.com>
2025-05-17 19:10:31 +01:00
Gnuxie
3d9d8abc43 update to interface-manager 4.1.0 (#847)
Fixes a tonne of shite mare.
Importantly https://github.com/the-draupnir-project/Draupnir/issues/845.
And something @ll-SKY-ll mentioned in the draupnir room regarding the new MentionLimitProtection.

Added

- Quote syntax to quote strings.
- Boolean presentation type and translator to string.

Fixed

- Added a pathway to create negative integers.
2025-05-14 23:51:19 +01:00
Gnuxie
32124edc5d Improve and stabalise the mention limit protection. (#844)
- Send a warning message when the event gets removed.
- Ban on the second infraction.
- Make it an option as to whether the message gets split.
- The config file won't work anymore can't fix that because wuh we can't have both as the source of truth........ unless we differentiate based on the timestamp but that requires infrastructure changes.
2025-05-13 21:47:53 +01:00
Rory&
62163a4afa Support loading http antispam token from file (#833)
* Support loading http antispam token from file

* Empty commit for signoff

Signed-off-by: Rory& <root@rory.gay>

---------

Signed-off-by: Rory& <root@rory.gay>
2025-05-12 12:12:19 +01:00
ll-SKY-ll
0bad7b29b0 Update HomeserverUserPolicyProtection.ts (#835)
Fix description for protection
2025-05-10 13:16:54 +01:00
gnuxie
656b8decb8 v2.3.0-beta.2 v2.3.0-beta.2 2025-04-14 18:36:42 +01:00
gnuxie
2f0f2fc026 --no-confirm was backwards in the Deactivate commands smh. 2025-04-14 18:33:40 +01:00
gnuxie
70a00e82e1 Update MPS4BotSDK to fix bugs in user redaction API. 2025-04-14 18:33:40 +01:00
gnuxie
720d703ca8 v2.3.0-beta.1 v2.3.0-beta.1 2025-04-14 16:30:44 +01:00
Gnuxie
92be1e6522 Exclude the bot from mention limit protection. (#815)
Fixes https://github.com/the-draupnir-project/Draupnir/issues/812.

Co-authored-by: nexy7574 <git@nexy7574.co.uk>
2025-04-14 15:53:29 +01:00
Gnuxie
98cf7bad8b Merge pull request #799 from the-draupnir-project/gnuxie/server-user-bans
Homeserver Admin: Restrict resident users automatically based on watched policy rooms

We introduce a new concept "restriction" which basically means "can a user send events from this account". Which is important when purging the messages sent from a user while deactivating their account.

We introduce a new protection, the `HomeserverUserPolicyApplication` protection which suspends users automatically when resident users match a policy from watched policy rooms. If the policy contains a reason for `config.automaticallyRedactForReasons`, then we prompt to do a purging deactivate (redact -> deactivate).

Users are also unsuspended as policies are removed.

We also introduce a `--purge-messages` and `--no-confirm` option to the `deactivate` command. This means that the command can now use the user redaction endpoint to redact messages and will shadowban the user while it does this if their account isn't already restricted. The addition of `--no-confirm` means that we now show a preview every time you run the deactivate command where you can review the user details before confirming the deactivation.

  

Follow up 1: https://github.com/the-draupnir-project/Draupnir/issues/813
Follow up 2: https://github.com/the-draupnir-project/Draupnir/issues/814
2025-04-14 15:36:31 +01:00
gnuxie
85574bce21 Add indexes to SqliteUserRestrictionAuditLog.
Should help with isUserRestricted.

Co-authored-by: Bea <20361868+enbea@users.noreply.github.com>
2025-04-14 15:09:39 +01:00
gnuxie
a09798cde8 Only unrestrict users when there are no more matching policies. 2025-04-14 10:56:47 +01:00
gnuxie
6e833db927 Simplify isUserRestrictied in SqliteUserRestrictionAuditLog.
Co-authored-by: Bea <20361868+enbea@users.noreply.github.com>
2025-04-13 20:38:03 +01:00
gnuxie
94d3f166fd Rename UserAuditLog to UserRestrictionAuditLog.
The name is more appropriate and we will probably keep the interfaces
distinct even if later somehow stores become merged.
2025-04-13 20:27:31 +01:00
gnuxie
3def9d0596 displayname is nully in synapse admin user details. 2025-04-13 20:06:36 +01:00
gnuxie
3e705c775f Update MPS. 2025-04-13 20:06:36 +01:00
gnuxie
c167c9e084 Use a new unrestrict command that is audited rather than unspsend. 2025-04-13 20:06:36 +01:00
gnuxie
af50fe22cd Unrestrict users automatically on policy changes too. 2025-04-13 20:06:36 +01:00
gnuxie
ba87ed2ed4 Prompt deactivation on automaticallyRedactForReasons. 2025-04-13 20:06:35 +01:00
gnuxie
4e4a1dec30 Add renderers to DeactivateCommand to show user details. 2025-04-13 20:06:35 +01:00
gnuxie
049f6ba182 Change DeactivateCommand to .tsx so we can use renderers. 2025-04-13 20:06:35 +01:00
gnuxie
0051263534 Rework deactivate command for a confirmation prompt and preview. 2025-04-13 20:06:35 +01:00
gnuxie
99bbbf5b01 Update the deactivate command to use the audit log and purging deactivate. 2025-04-13 20:06:35 +01:00
gnuxie
d8a6ba756b Load capabilities before protections.
Honestly i don't know why this wasn't done to begin with.
2025-04-13 20:06:35 +01:00
gnuxie
72f95563a5 Figure out how to apply policies to resident homserver users.
And also do purging deactivation in the background

We introduce "restriction" as a way to refer to an account that has
been suspended or locked or shadowbanned etc.

We also add a UserRestrictionCapability for protections to use the
functionality for suspending users.

We keep an audit log that updates when missing account restrictions
are discovered. (IE those that are prexisting)

The protection that makes these features available is the
HomeserverUserPolicyProtection.
2025-04-13 20:06:35 +01:00
gnuxie
419ac66259 Add a SqliteUserAuditLog store for a new user suspesion protection. 2025-04-13 13:15:44 +01:00
Catalan Lover
dc84ec5a6d Make MessageIsMediaProtection correctly check for noop (#807)
This PR fixes the temporary problem while we can fix the actual problem by reworking this whole idea of noop.

Fixes #808
2025-04-11 12:55:15 +01:00
nexy7574
4bb8da51dd Ignore redactions in BasicFlooding (fixes #804) (#805)
Fixes #804 by not considering m.room.redaction when processing basic flood protection.
2025-04-10 10:28:30 +01:00
Catalan Lover
d73d0fc4c2 Change mentions of Mjölnir to Draupnir (#796)
Cat ran into this funny leftover when validating if abuse reporting still works after Cats reworks in mdad. Turns out they do and as it was my first time using these flows Cat discovered this.
2025-03-30 17:52:53 +01:00
Gnuxie
5014489cc8 Merge pull request #794 from the-draupnir-project/gnuxie/user-suspension
Add commands to suspend/unsuspend users via the synapse admin API

- I have no idea how this interacts with MAS
- There is no locking available in the synapse admin API.
2025-03-29 20:20:55 +00:00
gnuxie
44c93c3766 Update matrix-protection-suite-for-matrix-bot-sdk v3.1.1. 2025-03-29 20:15:30 +00:00
gnuxie
a668d5637a Add suspend and unsuspend commands. 2025-03-29 20:15:30 +00:00
gnuxie
fdc4fd11a1 Move system admin commands to their own folder in commands directory. 2025-03-29 20:15:29 +00:00
dependabot[bot]
fb2f71fd32 Bump tar-fs from 2.1.1 to 2.1.2 (#789)
Bumps [tar-fs](https://github.com/mafintosh/tar-fs) from 2.1.1 to 2.1.2.
- [Commits](https://github.com/mafintosh/tar-fs/compare/v2.1.1...v2.1.2)

---
updated-dependencies:
- dependency-name: tar-fs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-28 23:03:12 +00:00
Gnuxie
ff4f78ee65 RedactionSynchronisationProtection invite retraction (#788)
- The _Redaction Synchronisation Protection_ has been improved in a few ways:
  - Invitations in protected rooms will be rejected as part of the redaction
    process when they are sent from users being redacted (e.g. as a brigading
    tactic).
  - User redaction will now be triggered on bans and the reason will be scanned
    for `automaticallyRedactForReasons` from Draupnir's config.

* Update RedactionSynchronisation for new protection apis.

* Rerwrite redaction synchronisation protection

* Reject invitations on ban.

* Add renderer and simulated redaction synchornisation capability.

* Reduce dependencies of redaction synchronisation protection.

* Allow RedactionSynchronisation to be unit tested.

* Update to MPS 3.1.0.

---------

Signed-off-by: Rory& <root@rory.gay>
Co-authored-by: Rory& <root@rory.gay>
2025-03-28 17:48:57 +00:00
gnuxie
d7df58101c v2.3.0-beta.0 v2.3.0-beta.0 2025-03-28 11:31:54 +00:00
Gnuxie
1b195e57e6 Update CHANGELOG for current changes. (#784)
* Update CHANGELOG for current changes.
2025-03-28 11:15:56 +00:00
Gnuxie
64de51496c Fixes to the new room takedown protection (#782)
* Take room pill out of takedown notice.

* Fix missing configSchema in RoomTakedownProtection.

It was always there... just not plumbed in.

* Fix RoomTakedownConfig schema was wrong.

Properties that default to undefined need to be optional because of
the way defaulting works.

* Fix missing name on RoomTakedownProtectionSettings.

* Fix joined_members missing from RoomBasicDetails.

Important because it's used for the threshold.

* Improve rendering of room discovery.

* Add SimulatedRoomTakedownCapability.

https://github.com/the-draupnir-project/planning/issues/41#issuecomment-2755447714

* Change renderer to include protection name.

For some reason addOneLiner does this but addMessage does not?

Something to look into there mare...
2025-03-27 21:52:59 +00:00
Gnuxie
ec6e0c6836 Fix roomStateBackingStore legacy migration. (#781)
This stuff got mixed up while applying a patch in the RoomTakedown protection drive.

Co-authored-by: Bea <20361868+enbea@users.noreply.github.com>
2025-03-27 20:33:52 +00:00