Documentation
¶
Index ¶
- type CheckResult
- type Engine
- func (e *Engine) Audit() *audit.Logger
- func (e *Engine) Check(args []string) CheckResult
- func (e *Engine) CheckInnerFunc() func(name string, args []string) error
- func (e *Engine) CheckInnerShellFunc() func(expr string) error
- func (e *Engine) Close()
- func (e *Engine) GlobalConfig() *config.GlobalConfig
- func (e *Engine) ListTools() []ToolEntry
- func (e *Engine) Registry() *spec.Registry
- func (e *Engine) Run(args []string) (int, error)
- func (e *Engine) ShellEnv(toolNames []string) []string
- func (e *Engine) ShellValidateOpts() shell.ValidateOpts
- type ToolEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckResult ¶
type CheckResult struct {
Allowed bool
Tool string
Args []string
Reason string // empty if allowed
ExitCode int // suggested exit code when blocked (0 if allowed)
}
CheckResult holds the outcome of a policy check.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func New ¶
func New(gc *config.GlobalConfig, cfgs []config.ConfigTool) *Engine
New creates an Engine from an explicit config and tool list.
func NewDefault ¶
func NewDefault() *Engine
func (*Engine) Check ¶
func (e *Engine) Check(args []string) CheckResult
Check validates a command against the policy without executing it.
func (*Engine) CheckInnerFunc ¶
CheckInnerFunc returns a function that validates a command against the engine's policy. Used by --sh shell validation (no NonInteractiveArgs needed).
func (*Engine) CheckInnerShellFunc ¶ added in v0.15.0
CheckInnerShellFunc returns a function that validates a shell expression against the engine's registry and options. Injected into shell interpreter tools.
func (*Engine) GlobalConfig ¶
func (e *Engine) GlobalConfig() *config.GlobalConfig
GlobalConfig returns the loaded global configuration.
func (*Engine) ShellEnv ¶
ShellEnv builds the environment for shell execution, merging non-interactive env from all tools referenced in the expression.
func (*Engine) ShellValidateOpts ¶
func (e *Engine) ShellValidateOpts() shell.ValidateOpts
ShellValidateOpts returns the standard options for shell.Validate, including writable dirs and the inner-command check function.