policy

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindProjectConfigPath

func FindProjectConfigPath(cwd string) string

FindProjectConfigPath locates .m/config.yaml from cwd to filesystem root.

Types

type InlineEngine

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

InlineEngine evaluates static rules loaded from config files.

func NewInlineEngine

func NewInlineEngine(rules []Rule) (*InlineEngine, error)

func (*InlineEngine) Check

func (e *InlineEngine) Check(toolName string, input json.RawMessage) string

Check returns an empty string if allowed or a deny reason if blocked.

type Rule

type Rule struct {
	Name            string   `yaml:"name"`
	Tool            string   `yaml:"tool,omitempty"`
	DenyPattern     string   `yaml:"deny_pattern,omitempty"`
	AllowPathPrefix []string `yaml:"allow_path_prefix,omitempty"`
	Message         string   `yaml:"message,omitempty"`
}

Rule defines one inline policy rule.

func LoadRules

func LoadRules(paths ...string) ([]Rule, error)

LoadRules reads policy.rules from the given config files and concatenates them.

Jump to

Keyboard shortcuts

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