Documentation
¶
Index ¶
- func ExecCommand(ctx context.Context, name string, args []string, env []string, ...) (stdout, stderr string, err error)
- type ToolInstaller
- func (i *ToolInstaller) CheckAllTools(ctx context.Context, config interface{}) error
- func (i *ToolInstaller) CheckInstalled(ctx context.Context, toolName string) error
- func (i *ToolInstaller) CheckInstalledWithVersion(ctx context.Context, toolName string) error
- func (i *ToolInstaller) GetInstallURL(toolName string) (string, error)
- func (i *ToolInstaller) GetToolCommand(toolName string) (string, error)
- func (i *ToolInstaller) InstallIfMissing(ctx context.Context, toolName string) error
- func (i *ToolInstaller) IsToolAvailable(ctx context.Context, toolName string) bool
- func (i *ToolInstaller) ListAvailableTools() []ToolMetadata
- type ToolMetadata
- type ToolRegistry
- func (r *ToolRegistry) Count() int
- func (r *ToolRegistry) GetInstallURL(name string) (string, error)
- func (r *ToolRegistry) GetMinVersion(name string) (string, error)
- func (r *ToolRegistry) GetRequiredTools(operations []string) []ToolMetadata
- func (r *ToolRegistry) GetTool(name string) (ToolMetadata, error)
- func (r *ToolRegistry) GetToolsByCategory(category string) []ToolMetadata
- func (r *ToolRegistry) HasTool(name string) bool
- func (r *ToolRegistry) ListTools() []ToolMetadata
- func (r *ToolRegistry) Register(tool ToolMetadata)
- func (r *ToolRegistry) Unregister(name string)
- type Version
- type VersionChecker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ToolInstaller ¶
type ToolInstaller struct {
// contains filtered or unexported fields
}
ToolInstaller checks tool availability and auto-installs missing tools.
func NewToolInstaller ¶
func NewToolInstaller() *ToolInstaller
NewToolInstaller creates a new tool installer.
func (*ToolInstaller) CheckAllTools ¶
func (i *ToolInstaller) CheckAllTools(ctx context.Context, config interface{}) error
CheckAllTools checks all required tools for a given security configuration
func (*ToolInstaller) CheckInstalled ¶
func (i *ToolInstaller) CheckInstalled(ctx context.Context, toolName string) error
CheckInstalled checks if a tool is available in PATH.
func (*ToolInstaller) CheckInstalledWithVersion ¶
func (i *ToolInstaller) CheckInstalledWithVersion(ctx context.Context, toolName string) error
CheckInstalledWithVersion checks if a tool is installed and meets minimum version requirements
func (*ToolInstaller) GetInstallURL ¶
func (i *ToolInstaller) GetInstallURL(toolName string) (string, error)
GetInstallURL returns the installation URL for a tool
func (*ToolInstaller) GetToolCommand ¶
func (i *ToolInstaller) GetToolCommand(toolName string) (string, error)
GetToolCommand returns the command name for a tool
func (*ToolInstaller) InstallIfMissing ¶
func (i *ToolInstaller) InstallIfMissing(ctx context.Context, toolName string) error
InstallIfMissing checks if a tool is installed and auto-installs it if not. Supports: cosign, syft, grype, trivy.
func (*ToolInstaller) IsToolAvailable ¶
func (i *ToolInstaller) IsToolAvailable(ctx context.Context, toolName string) bool
IsToolAvailable checks if a tool is available without returning an error
func (*ToolInstaller) ListAvailableTools ¶
func (i *ToolInstaller) ListAvailableTools() []ToolMetadata
ListAvailableTools returns all available tools in the registry
type ToolMetadata ¶
type ToolMetadata struct {
Name string // Tool name (e.g., "cosign", "syft")
Command string // Command to execute (usually same as name)
MinVersion string // Minimum required version (e.g., "3.0.2")
InstallURL string // URL with installation instructions
Description string // Brief description
VersionFlag string // Flag to get version (e.g., "version" or "--version")
}
ToolMetadata contains metadata about a security tool
type ToolRegistry ¶
type ToolRegistry struct {
// contains filtered or unexported fields
}
ToolRegistry maintains a registry of available security tools
func NewToolRegistry ¶
func NewToolRegistry() *ToolRegistry
NewToolRegistry creates a new tool registry with default tools
func (*ToolRegistry) Count ¶
func (r *ToolRegistry) Count() int
Count returns the number of registered tools
func (*ToolRegistry) GetInstallURL ¶
func (r *ToolRegistry) GetInstallURL(name string) (string, error)
GetInstallURL returns the installation URL for a tool
func (*ToolRegistry) GetMinVersion ¶
func (r *ToolRegistry) GetMinVersion(name string) (string, error)
GetMinVersion returns the minimum version for a tool
func (*ToolRegistry) GetRequiredTools ¶
func (r *ToolRegistry) GetRequiredTools(operations []string) []ToolMetadata
GetRequiredTools returns tools required for a given operation
func (*ToolRegistry) GetTool ¶
func (r *ToolRegistry) GetTool(name string) (ToolMetadata, error)
GetTool retrieves tool metadata by name
func (*ToolRegistry) GetToolsByCategory ¶
func (r *ToolRegistry) GetToolsByCategory(category string) []ToolMetadata
GetToolsByCategory returns tools that match a category Category can be: "signing", "sbom", "scan", "provenance"
func (*ToolRegistry) HasTool ¶
func (r *ToolRegistry) HasTool(name string) bool
HasTool checks if a tool is registered
func (*ToolRegistry) ListTools ¶
func (r *ToolRegistry) ListTools() []ToolMetadata
ListTools returns all registered tools
func (*ToolRegistry) Register ¶
func (r *ToolRegistry) Register(tool ToolMetadata)
Register adds or updates a tool in the registry
func (*ToolRegistry) Unregister ¶
func (r *ToolRegistry) Unregister(name string)
Unregister removes a tool from the registry
type Version ¶
Version represents a semantic version
func ParseVersion ¶
ParseVersion parses a version string into a Version struct
func (*Version) Compare ¶
Compare compares two versions Returns: -1 if v < other, 0 if v == other, 1 if v > other
type VersionChecker ¶
type VersionChecker struct {
// contains filtered or unexported fields
}
VersionChecker validates tool versions against minimum requirements
func NewVersionChecker ¶
func NewVersionChecker() *VersionChecker
NewVersionChecker creates a new version checker
func (*VersionChecker) CheckAllToolVersions ¶
func (c *VersionChecker) CheckAllToolVersions(ctx context.Context, tools []string) error
CheckAllToolVersions validates all tool versions
func (*VersionChecker) GetInstalledVersion ¶
GetInstalledVersion retrieves the installed version of a tool
func (*VersionChecker) ValidateVersion ¶
func (c *VersionChecker) ValidateVersion(toolName, installedVersion string) error
ValidateVersion checks if the installed version meets minimum requirements