Feature Request: Plugins receiving custom events should know the slug of the plugin that emitted them.
Share your bug report, feature request, or comment.
It would be useful for a plugin that registers custom events to know the slug of the plugin emitting said custom events. For example, some plugins may act maliciously, and if a plugin knows the slugs of malicious plugins, then it can blacklist it and know not to listen when it's emitting its custom events. Another case where it would be useful is if Plugin A tells Plugin B about a custom event that Plugin A is listening for that it wants Plugin B to emit. A Plugin C could come along telling Plugin B about a different custom event that Plugin A owns, causing the event to be fired when Plugin A doesn't want it to be.
The best way of doing this would be to just include the slug of a plugin emitting a custom event in the payload for said custom event. So an old payload of:
{
"eventType": "plugin-b.register-event",
"payload": {
"event": "plugin-a.event-name"
}
}Would now look like:
{
"eventType": "plugin-b.register-event",
"payload": {
"emittingPlugin": "plugin-a",
"data": {
"event": "event-name"
/*The above can also now be simplified to just showing the event name*/
}
}
}Now Plugin B can see which plugins are emitting register-event, and it can: blacklist them if necessary, make sure the events that are being registered are authentic, and doing anything else that having the slug of the emitting plugin might make useful.
Currently the only way for plugins to interoperate or create dependencies on each other is through the custom event system. This works well, but if plugins are going to rely on each other for exchanging information and creating new systems that each other can build off of, then it would be useful for plugins to be able to verify the authenticity of other plugins using their events.
Source: owncast/owncast