plugin

package
v0.14.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
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

func RegisterRuntimePlugins(ctx context.Context, reg registryWriter, root string) error

RegisterRuntimePlugins loads enabled external plugins into the scan registry.

func Uninstall

func Uninstall(root, id string) error

Uninstall removes one installed external plugin.

func WithLaunchOptions

func WithLaunchOptions(ctx context.Context, options LaunchOptions) context.Context

WithLaunchOptions returns a context carrying managed plugin launch options.

Types

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

func Doctor(ctx context.Context, root, id string, builtins []Info) (*DoctorResult, error)

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

func ListPluginInfos(root string, builtins []Info) ([]Info, error)

ListPluginInfos returns built-in and installed plugin info in one list.

func LoadInstalledPlugins

func LoadInstalledPlugins(root string) ([]Info, error)

LoadInstalledPlugins returns the full installed managed-plugin set.

func LoadRuntimePlugins

func LoadRuntimePlugins(root string) ([]Info, error)

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      map[string]map[string]any
}

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"`
}

RuntimeDescriptorSnapshot stores Bomly-verified runtime descriptors for an installed plugin.

type TestResult

type TestResult struct {
	Info
	Ready bool   `json:"ready"`
	Probe string `json:"probe,omitempty"`
}

TestResult describes runtime readiness checks for one plugin.

func Test

func Test(ctx context.Context, root, id string, builtins []Info) (*TestResult, error)

Test probes runtime readiness for one plugin (external or built-in). builtins should be the full list returned by ListPluginInfos for the current binary; when the id is found only in builtins, the plugin is reported as ready without launching an external process.

type VerifyResult

type VerifyResult struct {
	Info
	Checks []string
}

VerifyResult describes the checks performed for one plugin.

func Verify

func Verify(ctx context.Context, root, id string) (*VerifyResult, error)

Verify validates one installed managed plugin.

Directories

Path Synopsis
runtime

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL