policy

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mode

type Mode string
const (
	ReadOnly Mode = "read_only"
	SafeCore Mode = "safe_core"
	Standard Mode = "standard"
	Full     Mode = "full"
)

type Policy

type Policy struct {
	Mode           Mode
	DeniedTools    map[string]bool
	DeniedGroups   map[string]bool
	AllowedGroups  map[string]bool // nil = not set (all allowed per mode)
	Tier1ToolNames map[string]bool // populated after registry construction
}

func FromEnv

func FromEnv() (*Policy, error)

func (*Policy) BlockReason

func (p *Policy) BlockReason(name string, readOnly bool) string

BlockReason returns a human-readable explanation for why a tool is blocked.

func (*Policy) Clone

func (p *Policy) Clone() *Policy

func (*Policy) Describe

func (p *Policy) Describe() map[string]any

Describe returns a map describing the current policy configuration.

func (*Policy) IsAllowed

func (p *Policy) IsAllowed(name string, readOnly bool) bool

func (*Policy) IsGroupAllowed

func (p *Policy) IsGroupAllowed(group string) bool

IsGroupAllowed reports whether tools in the given group are permitted.

func (*Policy) SetTier1Tools

func (p *Policy) SetTier1Tools(names map[string]bool)

SetTier1Tools stores the set of Tier-1 tool names for later reference.

Jump to

Keyboard shortcuts

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