guardicore / guardicore/monkey
Formalize pluggable events
- Dominant language
- Python
- Stars
- 7.1k
- Forks
- 830
- PR merge metrics
- No merged PRs in 30d
Description
## Description
Take the prototype developed in #2966 and make it production-ready.
## Tasks
- [ ] Add `AgentPluginManifest.custom_events`
- [ ] Move `PluginSourceExtractor` into Common
- [ ] Add a plugin events loader under `common/` (refer to [this](https://github.com/guardicore/monkey/blob/076ebfeecd55e5cfd5e7dc8c6cbe3e996c255089/monkey/common/agent_plugins/plugin_events_loader.py) in the prototype)
- [ ] Add unit tests
- [ ] Add an abstract method to `IAgentPluginRepository` which gets a plugin only by type and name, i.e. without the OS filter (to load custom events, we only need the manifest, we don't care about the OSes that the plugin supports)
- [ ] Implement the above abstract method in `FileAgentPluginRepository` with the help of `_deduplicate_os_specific_plugins()`
- [ ] Register plugins' custom events in the Island during server setup (refer to [this](https://github.com/guardicore/monkey/compare/prototype-custom-events#diff-0b26f2fa2b1b73f2dc0d2d8b53a3e9a4de8435ae365d79ca53e0e1ed4defe574R88-R120) in the prototype)
- [ ] Remove the temporary directory created for plugin extraction after all custom events are registered
- [ ] Register plugins' custom events in the Agent
- [ ] (?) Add `IAgentEventSerializerRegistry` and use it
- [ ] Modify `AbstractIslandAPIClientFactory` and `HTTPIslandAPIClientFactory` to accept `AgentEventSerializerRegistry` in `create_island_api_client()` and not the constructor
- [ ] Set up the `AgentEventSerializerRegistry` using a manager in `monkey.py` (refer to [this](https://github.com/guardicore/monkey/compare/prototype-custom-events#diff-ef2b540ddd60ad80f8e486a366063f0c71e7dbe42bb3c6ebaa67c24dfa10e82fR126-R435) in the prototype)
- [ ] Register custom events in `PluginRegistry` (refer to [this](https://github.com/guardicore/monkey/compare/prototype-custom-events#diff-13cb9647c19281059817120cc2404cd18b4cdcdab4fd8a62c9c2f69c5991009fR70-R79) in the prototype)
- [ ] Create a mock plugin for testing (refer to [this](https://github.com/guardicore/monkey/commit/19df0758c96e322ee7b6fc2e7b758a5e9952d924) in the prototype)
- [ ] Clear events when a plugin is uninstalled
Contributor guide
Assessment
This issue has not been assessed yet.