-
-
Notifications
You must be signed in to change notification settings - Fork 768
Description
Is your feature request related to a problem? Please describe.
The current plugin system is built 5+ years ago with the Go dynamic loader when options were more limited. Building Go plugins were complicated, has limited OS support (requires glibc or MacOS) and runtime loading errors can be very difficult to debug.
Describe the solution you'd like
I still think a binary plugin system can be useful as backward compatibility/escape hatch, but my observations are most plugins are designed for basic message piping (like my broadcast plugin) or message format support.
I propose we transition the current plugin architecture to be IPC based (we execute the plugin file and communicate with it using sockets). This gives us:
- Backwards compatibility: existing plugins can just add a generic
main
function we provide , build as an executable and work. - Security isolation: if there are security vulnerabilities in the plugin the gotify process itself has more isolation. Moreover we can potentially enable the use of OS features (seccomp-bpf, etc) for users to load plugins with limited permissions.
Most of the APIs are easy to change with the exception of Webhooker
, I am thinking about run a different instance of Gin on the plugin side and just use a mux to make the plugin answer for that HTTP request over the socket. This will wipe the remote address information from the object, we can try to emulate it back in our provided compatibility layer or make it a breaking change.
Describe alternatives you've considered
I have some other ideas but it seems be too drastic/too specialized for a specific situation. Feel free to disagree or improve on that!
- A gojq based message transformation program per app.
- Transition the whole Plugin architecture to WASM (maybe later, but I think keeping native code execution for compatibility and get us out of this dependency matching situation is more useful). This allows for plugins to be written in any language, loaded and unloaded on demand and super easy runtime permission control but it is not native code so will lose backwards compatibility