Documentation
¶
Index ¶
- Constants
- func RegisterRuntimePlugins(ctx context.Context, reg registryWriter, root string) error
- func Uninstall(root, id string) error
- func WithLaunchOptions(ctx context.Context, options LaunchOptions) context.Context
- type ClientPool
- type DoctorResult
- type Info
- type InstallOptions
- type InstallResult
- type InstalledDB
- type InstalledPlugin
- type LaunchOptions
- type ListResponse
- type Manifest
- type RuntimeDescriptorSnapshot
- type TestResult
- type VerifyResult
Constants ¶
const ( // EnvPluginHome overrides the default plugin store root for tests and advanced usage. EnvPluginHome = "BOMLY_PLUGIN_HOME" // EnvPluginAPIVersion is passed to managed plugin subprocesses. EnvPluginAPIVersion = "BOMLY_PLUGIN_API_VERSION" // EnvPluginConfig is passed to managed plugin subprocesses. EnvPluginConfig = "BOMLY_CONFIG" )
Variables ¶
This section is empty.
Functions ¶
func RegisterRuntimePlugins ¶
RegisterRuntimePlugins loads enabled external plugins into the scan registry.
func WithLaunchOptions ¶
func WithLaunchOptions(ctx context.Context, options LaunchOptions) context.Context
WithLaunchOptions returns a context carrying managed plugin launch options.
Types ¶
type ClientPool ¶ added in v0.22.0
type ClientPool struct {
// contains filtered or unexported fields
}
ClientPool keeps one live managed-plugin subprocess per plugin ID so repeated component calls within a command reuse a warm process instead of paying a full handshake per RPC.
func NewClientPool ¶ added in v0.22.0
func NewClientPool() *ClientPool
NewClientPool creates an empty plugin subprocess pool.
func (*ClientPool) Acquire ¶ added in v0.22.0
func (p *ClientPool) Acquire(ctx context.Context, executable, pluginID string, kind plugschema.PluginKind) (plugschema.Client, error)
Acquire returns a live client for the plugin, starting the subprocess on first use and restarting it at most once per pool lifetime when it died. The returned client is shared: callers must not close it; the pool owns the subprocess until Shutdown.
func (*ClientPool) Shutdown ¶ added in v0.22.0
func (p *ClientPool) Shutdown()
Shutdown terminates every pooled subprocess and runs config-file cleanups. The pool remains usable afterwards, but callers are expected to drop it.
type DoctorResult ¶
type DoctorResult struct {
Info
Checks []string `json:"checks,omitempty"`
Ready bool `json:"ready"`
Healthy bool `json:"healthy"`
Probe string `json:"probe,omitempty"`
}
DoctorResult describes combined verification and runtime readiness checks.
func Doctor ¶
Doctor runs verification and runtime readiness checks for one plugin (external or built-in). builtins should be the full list returned by ListPluginInfos for the current binary. For built-in plugins the verify step is skipped (there is no external binary to inspect) and readiness is reported as healthy without launching an external process.
type Info ¶
type Info struct {
Manifest
DetectorDescriptor *plugschema.DetectorDescriptor `json:"detectorDescriptor,omitempty"`
MatcherDescriptor *plugschema.MatcherDescriptor `json:"matcherDescriptor,omitempty"`
AuditorDescriptor *plugschema.AuditorDescriptor `json:"auditorDescriptor,omitempty"`
AnalyzerDescriptor *plugschema.AnalyzerDescriptor `json:"analyzerDescriptor,omitempty"`
Installed *InstalledPlugin
BuiltIn bool
Enabled bool
Entrypoint string
SourceType string
// ReadyFn, when non-nil, is called by Test() to probe readiness for built-in plugins.
// Populated by the CLI layer from the in-process component instance.
// Never serialized to JSON.
ReadyFn func(context.Context) (bool, string, error) `json:"-"`
}
Info is the combined managed-plugin view used by the CLI and runtime loader.
func ListPluginInfos ¶
ListPluginInfos returns built-in and installed plugin info in one list.
func LoadInstalledPlugins ¶
LoadInstalledPlugins returns the full installed managed-plugin set.
func LoadRuntimePlugins ¶
LoadRuntimePlugins loads enabled external plugins.
type InstallOptions ¶
type InstallOptions struct {
DevBinary bool
Checksum string
InsecureSkipChecksum bool
// contains filtered or unexported fields
}
InstallOptions controls plugin installation behavior.
type InstallResult ¶
type InstallResult struct {
Manifest Manifest
Installed InstalledPlugin
ResolvedSource string
ChecksumVerified bool
}
InstallResult describes the installed plugin.
func Install ¶
func Install(ctx context.Context, root, source string, opts InstallOptions) (*InstallResult, error)
Install installs a managed plugin from a local archive, local dev binary, or direct URL.
type InstalledDB ¶
type InstalledDB struct {
SchemaVersion string `json:"schemaVersion"`
Plugins []InstalledPlugin `json:"plugins"`
}
InstalledDB stores the installed plugin set.
type InstalledPlugin ¶
type InstalledPlugin struct {
ID string `json:"id"`
Version string `json:"version"`
Enabled bool `json:"enabled"`
Source string `json:"source,omitempty"`
Checksum string `json:"checksum,omitempty"`
Path string `json:"path"`
Runtime string `json:"runtime"`
Kind plugschema.PluginKind `json:"kind,omitempty"`
}
InstalledPlugin records one plugin installation.
func Disable ¶
func Disable(root, id string) (*InstalledPlugin, error)
Disable marks one installed plugin disabled.
func Enable ¶
func Enable(root, id string) (*InstalledPlugin, error)
Enable marks one installed plugin enabled.
type LaunchOptions ¶
type LaunchOptions struct {
ConfigPath string
Verbosity int
HTTPProxy string
HTTPNoProxy string
HTTPProxyType string
HTTPProxyHost string
HTTPProxyPort int
HTTPProxyUsername string
HTTPProxyPassword string
HTTPCACertFile string
HTTPClientProvider *plugschema.HTTPClientProvider
// PluginConfigs carries the kind-scoped per-component configuration
// resolved from the CLI config. Launch-time lookups are by plugin ID,
// which is unique across the install database.
PluginConfigs config.PluginConfigs
// Pool, when set, keeps one live subprocess per plugin for the lifetime of
// the owning command instead of launching one per call. Never serialized.
Pool *ClientPool
}
LaunchOptions carries launch context for managed external plugins.
func LaunchOptionsFromContext ¶
func LaunchOptionsFromContext(ctx context.Context) (LaunchOptions, bool)
LaunchOptionsFromContext returns managed plugin launch options from ctx.
type ListResponse ¶
type ListResponse struct {
Detectors []Info `json:"detectors"`
Matchers []Info `json:"matchers"`
Auditors []Info `json:"auditors"`
Analyzers []Info `json:"analyzers"`
}
ListResponse is the structured JSON response for the plugin list command, with plugins grouped by kind.
func GroupPluginInfos ¶
func GroupPluginInfos(infos []Info) ListResponse
GroupPluginInfos groups a flat slice of PluginInfo by kind into a PluginListResponse.
type Manifest ¶
type Manifest struct {
SchemaVersion string `json:"schemaVersion"`
ID string `json:"id"`
Name string `json:"name"`
Version string `json:"version"`
Kind plugschema.PluginKind `json:"kind"`
Runtime string `json:"runtime"`
PluginAPIVersion string `json:"pluginApiVersion"`
BomlyVersion string `json:"bomlyVersion"`
Entrypoint map[string]string `json:"entrypoint"`
Source string `json:"source,omitempty"`
Description string `json:"description,omitempty"`
Homepage string `json:"homepage,omitempty"`
License string `json:"license,omitempty"`
}
Manifest describes one installed managed plugin package.
type RuntimeDescriptorSnapshot ¶
type RuntimeDescriptorSnapshot struct {
SchemaVersion string `json:"schemaVersion"`
ID string `json:"id"`
Kind plugschema.PluginKind `json:"kind"`
PluginAPIVersion string `json:"pluginApiVersion"`
DetectorDescriptor *plugschema.DetectorDescriptor `json:"detectorDescriptor,omitempty"`
MatcherDescriptor *plugschema.MatcherDescriptor `json:"matcherDescriptor,omitempty"`
AuditorDescriptor *plugschema.AuditorDescriptor `json:"auditorDescriptor,omitempty"`
AnalyzerDescriptor *plugschema.AnalyzerDescriptor `json:"analyzerDescriptor,omitempty"`
}
RuntimeDescriptorSnapshot stores Bomly-verified runtime descriptors for an installed plugin.
type TestResult ¶
TestResult describes runtime readiness checks for one plugin.