policy

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPolicy

func NewPolicy(opts ...PolicyOption) ports.Policy

NewPolicy creates a new Policy.

Types

type NopDenialHandler

type NopDenialHandler struct{}

NopDenialHandler does nothing.

func (*NopDenialHandler) OnDenial

func (h *NopDenialHandler) OnDenial(kind string, request interface{}, reason string)

type Policy

type Policy struct {
	// contains filtered or unexported fields
}

Policy implements the Policy interface with stateless enforcement.

func (*Policy) CheckEnvironment

func (p *Policy) CheckEnvironment(req entities.EnvironmentRequest, grants *entities.GrantSet) bool

func (*Policy) CheckExec

func (p *Policy) CheckExec(req entities.ExecCapabilityRequest, grants *entities.GrantSet) bool

func (*Policy) CheckFileSystem

func (p *Policy) CheckFileSystem(req entities.FileSystemRequest, grants *entities.GrantSet) bool

func (*Policy) CheckKeyValue

func (p *Policy) CheckKeyValue(req entities.KeyValueRequest, grants *entities.GrantSet) bool

func (*Policy) CheckNetwork

func (p *Policy) CheckNetwork(req entities.NetworkRequest, grants *entities.GrantSet) bool

type PolicyOption

type PolicyOption func(*policyConfig)

PolicyOption configures the Policy.

func WithDenialHandler

func WithDenialHandler(h ports.DenialHandler) PolicyOption

WithDenialHandler sets the denial handler.

func WithSymlinkResolution

func WithSymlinkResolution(enabled bool) PolicyOption

WithSymlinkResolution enables/disables symlink resolution. Default is true (secure). Disable only for testing.

func WithWorkingDirectory

func WithWorkingDirectory(cwd string) PolicyOption

WithWorkingDirectory sets the working directory for relative path resolution.

type StderrDenialHandler

type StderrDenialHandler struct{}

StderrDenialHandler logs denials to stderr.

func (*StderrDenialHandler) OnDenial

func (h *StderrDenialHandler) OnDenial(kind string, request interface{}, reason string)

Jump to

Keyboard shortcuts

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