Pluggable activity handlers

Pleroma server has a subsystem called Message Rewrite Facility (MRF):

The Message Rewrite Facility (MRF) is a subsystem that is implemented as a series of hooks that allows the administrator to rewrite or discard messages.
Possible uses include:

  • marking incoming messages with media from a given account or instance as sensitive
  • rejecting messages from a specific instance
  • rejecting reports (flags) from a specific instance
  • removing/unlisting messages from the public timelines
  • removing media from messages
  • sending only public messages to a specific instance

The possibilities are truly limitless. Instance administrators can add/remove modules, write their own and share them. Unfortunately, Pleroma MRF modules are written in Elixir, and therefore can’t be easily used on other platforms.

What if we develop a standard for portable activity processing plugins? Plugins can be written in some lightweight scripting language such as Lua, or compiled into WebAssembly. I think this kind of plugin system could become indispensable for moderation and spam protection as the Fediverse grows.

4 Likes

Somewhat related: If activity handler can reject activity based on some condition, this condition should be represented at the protocol level.
For example, if the server automatically rejects follow requests that don’t contain some kind of proof to reduce spam, the actor object may indicate this in the following way:

{
  "id": "https://example.com/users/alice",
  "type": "Person",
  "canFollow": {
    "type": "ProofOfX",
    "description": "Do X before following me"
  }
}

FEP-5624 describes something similar for replies, but it is very limited because the proposed canReply property simply lists actors who can reply. A proper solution should be compatible with all kinds of locks and approval mechanisms.

I guess this is the area where object capabilities would be actually useful.