-
-
Notifications
You must be signed in to change notification settings - Fork 110
feat: Add support for custom autodiscovery plugin #7034
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Olblak <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for custom autodiscovery plugins using WebAssembly (WASM) via the Extism framework. The feature enables users to write custom autodiscovery logic in multiple languages (Rust, JS, Go, C#, F#, C, Haskell, and Zig) that can be executed in a secure sandboxed environment.
Key Changes:
- Introduces a new WASM-based plugin system for autodiscovery with configurable allowed paths, hosts, and timeouts
- Integrates plugin support into the existing autodiscovery framework with experimental feature flag protection
- Provides host functions for plugins to interact with Updatecli's Docker image source spec generation
Reviewed changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
pkg/plugins/autodiscovery/plugin/main.go |
Core plugin implementation with WASM initialization and manifest discovery logic |
pkg/plugins/autodiscovery/plugin/spec.go |
Plugin specification structure defining allowed paths, hosts, and timeout configuration |
pkg/plugins/autodiscovery/plugin/utils.go |
Utility function for processing and normalizing allowed paths for WASM sandbox |
pkg/plugins/autodiscovery/plugin/hostFunction.go |
Host function exposing Docker source spec generation to WASM plugins |
pkg/plugins/autodiscovery/plugin/main_test.go |
Test suite validating plugin execution with demo WASM binary |
pkg/core/pipeline/autodiscovery/main.go |
Integration point adding plugin crawler support with .wasm file detection |
pkg/plugins/autodiscovery/plugin/testdata/demo/data.txt |
Test data for demo plugin validation |
e2e/updatecli.d/success.d/autodiscovery/plugin/updatecli.yaml |
End-to-end test configuration demonstrating plugin usage |
go.mod |
Added Extism and Wazero dependencies for WASM runtime |
go.sum |
Dependency checksums for new WASM-related packages |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Olblak <[email protected]>
Signed-off-by: Olblak <[email protected]>
Signed-off-by: Olblak <[email protected]>
Signed-off-by: Olblak <[email protected]>
Signed-off-by: Olblak <[email protected]>
Related to #5730
Add support for custom autodiscovery plugin using WASM.
This feature leverage the WASM framework Extism which allows writing plugin using Rust, JS, Go, C#, F#, C, Haskell, and Zig
I also created this repository https://github.com/updatecli/plugins to host a plugin example.
A simple Updatecli manifest looks like
Where the autodiscovery crawler kind can be a file with the ".wasm" extension
At the moment it supports local files but we can envision supporting OCI artifacts in order to push/push plugins similar to Updatecli shared policies.
Please note that WASM comes with its own set of limitations.
Test
To test this pull request, you can run the following commands:
Additional Information
Checklist
Tradeoff
By default, a WASM container doesn't have access to the host local files. For that we need to allow list some path such as
If
allowedpathsis unset, then I made the decision to automatically load the local directory or the scm directory if a scm configuration is specified, to reduce the amount of configuration needed in the Updatecli manifest.By default, a WASM binary is executed from the directory
/mntPotential improvement