Commit Graph

767 Commits

Author SHA1 Message Date
Gnuxie
5565ef3bc7 Use json reviver in express.json() middleware. (#913) 2025-06-24 13:49:04 +01:00
gnuxie
2ad39d9dbd Ensure appservice calls stop on draupnir.
This is now apparent because the protection that deletes events with
erroneous mixins uses a lazy leaky bucket which has a timeout that
needs cancelling. This will probably fix a few unexplained issues as a
side effect.
2025-06-24 11:46:30 +01:00
gnuxie
d61e225f25 Elaborate on how WordList protection works. 2025-06-24 11:20:29 +01:00
gnuxie
05129ed855 Update WordList protection for new event mixin model.
DRP-003.
2025-06-24 11:20:29 +01:00
gnuxie
0616706747 Add InvalidEventProtection to redact events with invalid mixins.
We're quite liberal with our mixin definitions, so we redact events
that don't conform because they could clearly be attempts to play with
clients or protections that don't play nicely.
2025-06-24 11:20:29 +01:00
gnuxie
a0a184643d Update MentionLimitProtection for new event mixins model. 2025-06-24 11:20:29 +01:00
gnuxie
e0dc7b77d1 Update MentionLimitProtection to use handleTimelineMedia.
This is a better API provided by MPS that already handles safe parsing
of Matrix events to extract relevant media.
2025-06-24 11:20:29 +01:00
Gnuxie
e0f6050029 Fix compatibility of PersistentConfigData and PersistentConfigBackend. (#912)
This led to protections not instantiating with their defaults when
their config was requested. Infact, it meant that their configs were
not validated at all.

Fixes https://github.com/the-draupnir-project/Draupnir/issues/911.
2025-06-23 21:15:05 +01:00
Gnuxie
1cc6a9162b Consolidate Synpase admin room details schema. (#907)
Change comes from mps-for-bot-sdk. We're not trusting the room list
or the room details endpoint anymore.
2025-06-19 18:14:00 +01:00
Gnuxie
026de3b9cb Account for creators missing in synapse room table. (#905)
This really and deeply sucks
https://github.com/element-hq/synapse/issues/18563.
2025-06-17 17:13:41 +01:00
gnuxie
bb8baaa473 Rigidity wrt disposing stores and protections. 2025-06-17 12:27:03 +01:00
gnuxie
96aaf072d5 Disable the room discovery notification room by default. 2025-06-17 12:27:03 +01:00
gnuxie
a5a1bdd402 Support room discovery via the synapse admin room list. 2025-06-17 12:27:03 +01:00
Catalan Lover
ec388467e4 Add the ability to customise the primary prefix for commands. (#899)
* Add the ability to customise the primary prefix for commands.

* Fix data structure error in config.yaml / harness.yaml

* Apply suggestions from code review

---------

Co-authored-by: Gnuxie <50846879+Gnuxie@users.noreply.github.com>
2025-06-16 20:39:01 +01:00
Gnuxie
f46ff4dddd Implement synapse-http-antispam /ping. (#897)
2a36ef305b
2025-06-09 11:43:19 +01:00
gnuxie
2e0b9dfb98 Extract out and depend upon @the-draupnir-project/mps-interface-adaptor. 2025-06-02 19:52:44 +01:00
Gnuxie
ed9a14b84d Only invite joined members to the Notification Rooms. (#885)
* Only invite joined members to the Notification Rooms.

* Make NotificationRoom creation invitations more resistant.
2025-05-29 19:49:22 +01:00
gnuxie
6f15fc27c6 Use room delete V2 for takedowns/shutdowns to not notify.
Seems i got it backwards?? or this is just totally random.
2025-05-29 15:20:36 +01:00
gnuxie
1cb9899963 Stop taking down rooms by server and sender.
https://github.com/the-draupnir-project/Draupnir/issues/880.
Postpone takedown by creator for now.
We haven't got time to make sure everything's working and figure out
the UX.
2025-05-29 14:52:34 +01:00
gnuxie
80473155d9 Needs testing, added pathways to takedown rooms by server and sender. 2025-05-29 14:52:34 +01:00
gnuxie
804dfa0e33 Return the new protection instead of playing about. 2025-05-27 14:39:42 +01:00
gnuxie
11025f2ae5 Re-enable room discovery by default now that it creates a distinct room. 2025-05-27 11:57:23 +01:00
gnuxie
3d138d96df Remove seperate room for policy change notification protection.
I don't think we're ready for it yet.
2025-05-27 11:55:00 +01:00
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
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
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
2f0f2fc026 --no-confirm was backwards in the Deactivate commands smh. 2025-04-14 18:33:40 +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
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
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